2
Answers

How to detect if ie enable/disable cookie?

steven

steven

13y
2.1k
1
1.Disable your ie cookie
2. The source code is here, which would detect if ie enable/disable cookie. On the machines in my office and my home, it still can write and read cookie even though i have disable cookie in IE options. Can you help me take a look? Thanks.
http://files.cnblogs.com/silva/CookieDemo.rar
Answers (2)
0
Suthish Nair

Suthish Nair

NA 31.7k 4.6m 13y

 Two things...

  1.  You need to have a IsPostBack check on Page Load of WebForm1.
            if (!IsPostBack)
            {
                if (Request.Cookies["Name3"] != null)
                    Response.Cookies.Remove("Name3");

                HttpCookie c = new HttpCookie("Name3", "Suthish Nair!");
                c.Expires = DateTime.Now.AddSeconds(1);

                Response.Cookies.Add(c);
            }

  2. Remember you used 1 minute in .AddMinutes method, so you have to wait for 1 minute and then do redirection.





0
Prabhu Raja

Prabhu Raja

NA 4.7k 1.5m 13y
Hi,

We can disable Cookies by ,

HttpCookie cookieObj = Request.Cookies["Name3"];
        if (cookieObj != null)
        {
            cookieObj.Expires = DateTime.Now.AddDays(-1);
            Response.Cookies.Add(cookieObj);
       }