How to create a non-persistent (in memory) http cookie in C#?

Posted by MatthewMartin on Stack Overflow See other posts from Stack Overflow or by MatthewMartin
Published on 2010-12-21T15:01:06Z Indexed on 2010/12/21 15:54 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

I want my cookie to disappear when the user closes their brower-- I've already set some promising looking properties, but my cookies pop back to live even after closing the entire browser.

HttpCookie cookie = new HttpCookie("mycookie", "abc");
cookie.HttpOnly = true; //Seems to only affect script access
cookie.Secure = true; //Seems to affect only https transport

What property or method call am I missing to achieve an in memory cookie?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET