Newbie
Newbie

Reputation: 31

Cookie not working in IE

Cookies are not working with IE. The browser is set to allow cookies. It works fine in Firefox... and works fine in IE when I run it locally. But as soon as I publish, it breaks. It is used for a poll so a user cannot vote more than once. The following code runs once a user tries to vote:

if (Request.Cookies["Poll"] != null && Request.Cookies["Poll"].Value == "Voted")
{
    // Display label
    lblVoted.Visible= true;
}
else
{
    // Update DB
    // Add cookie
    Response.Cookies["Poll"].Value = "Voted";
    Response.Cookies["Poll"].Expires = DateTime.Now.AddDays(30);
}

Upvotes: 3

Views: 3427

Answers (2)

EricLaw
EricLaw

Reputation: 57075

If your cookie is a 3rd party cookie (e.g. in a subframe from a different origin) then the setting of the cookie would likely be blocked by P3P). Click View > Web Page Privacy Policy to see if any cookies are blocked.

Upvotes: 1

nemke
nemke

Reputation: 2458

Maybe you have underscore in your local server name. Sometimes this can be an issue. Check http://www.enhanceie.com/ie/bugs.asp

Upvotes: 2

Related Questions