'How to disable cookies from a page?
I have a web page created using asp.net and c# and I want cookies disabled.
I try <SettingsCookies Enabled="false" />. But when I open the page and Firebug the cookie is there.
How can I disable cookies?
Thank you for your help
Solution 1:[1]
Use following code:
string MyCookieValue;
if(Request.Cookies["ID"] != null)
Response.Cookies["ID"].Expires = DateTime.Now.AddDays(-1);
Can follow this link:
http://www.beansoftware.com/ASP.NET-Tutorials/Cookies-ASP.NET.aspx
Will get all things about cookies.
Solution 2:[2]
Interestingly putting <httpCookies httpOnlyCookies="false"/> doesn't seem to disable
httpOnlyCookies in ASP.NET 2.0:
http://nerd.steveferson.com/2007/09/14/act-sessionid-and-login-problems-with-asp-net-20/
Looks like Microsoft took the decision to not allow you to disable it from the web.config:
http://forums.asp.net/p/976773/1240648.aspx
Possible options
<httpCookies domain="" httpOnlyCookies="true|false" requireSSL="true|false" />
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Freelancer |
| Solution 2 | शेखर |
