Tuesday, September 6, 2016

Windows IIS and weird cookie expiration

So the authentication cookies served by your lovely ASP.NET site (whether MVC or WebForms) are mysteriously not taking effect in Google Chrome and Firefox, but are, for whatever reason, working in Internet Explorer and Microsoft Edge.

Did you, by any chance, play with your server's (or dev box's) clock recently?

Turns out that IIS can get "stuck in the future", even after you turn the clock back.

After many hours of wasted time, I came across this - and hopefully my little post here and the keywords in it will help you find it much, much sooner and save you hours:

http://serverfault.com/questions/217343/date-header-returned-by-iis7-is-wrong

In short?  Restart the service called "http".  (net stop http, net start w3svc)  Or reboot.

Restarting just w3svc (which I had already tried) is not enough.

Enjoy all those extra hours of you life you just got back!  :)