How can I detect if a request and response cookies are different?

Posted by Malcolm Frexner on Stack Overflow See other posts from Stack Overflow or by Malcolm Frexner
Published on 2010-03-18T10:52:57Z Indexed on 2010/03/20 0:11 UTC
Read the original article Hit count: 166

Filed under:
|

I need to detect if a request cookie - value is different from a response cookie - value.

Its not as easy as:

if(cookiesArePresent)
{
    bool isDifferent = HttpContext.Current.Response.Cookies[".ASPXANONYMOUS"].value == HttpContext.Current.Response.Cookies[".ASPXANONYMOUS"].value;
}

But I read that changing the Response.Cookies changes the Request.Cookies. That would mean they are always the same if HttpContext.Current.Response.Cookies[".ASPXANONYMOUS"] was changed. Is there an easy way around this?

http://chance.lindseydev.com/2009/04/aspnet-httprequestcookies-and.html

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about cookies