It seems from msdn(comment at the page bottom), if you set the Expires property of a HttpCookie, it becomes a persistent cookie stored in the temp internet files folder. What to do if I want it to remain a session cookie (which means when you close the browser, it’s gone), but still want to set the expiration time, say to 30 minutes? When you use the ASP.NET Membership API, you can set the expiration of a session cookie(the authentication cookie) in web.config, so it means there must be a way to set session cookie’s expiration time.
Share
Taking into account your requirement I’d say that unless you have a very strong reason to use cookies you should be using the
Sessionobject.If you’re not storing a “big” amount of information on this cookie and / or the number of users is not expected to be considerable this seems to be the best option.