How do I set cookie expiration time in C#?
I want cookies to expire when the browser is closed. I found in many blogs that giving a previous date as the expiry date will cause the cookie to automatically expire, but that is not working in my case.
Hii bhasker,
The simple answer for your question is, do not explicitly specify cookie expiry time at the time of creation of a cookie. Then it will expire when the session is completed or the browser is closed.
You also have to close all other pages from the same browser, for example if you are using firefox, you have a process nameed firefox.exe which will not end until last window is open and session wil not expire
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With