Don't use Response.Cookies[string] to check if a cookie exists!
Update: Follow Up Posts
- Use wrappers to access your cookies, sessions, …
- Testable and reusable cookie access with ASP.Net MVC RC
The short explanation, if you don’t like to read the entire story
If you use code like if (Response.Cookies["mycookie"] != null) { … }
, ASP.Net automatically generates a new cookie with the name “mycookie” in the background and overwrites your old cookie! Always use the Request.Cookies-Collection to read cookies!