I am having problems with my login page (see my first problem here: asp.net login fails on first and second call - I'm not sure if these two problems are related).
My second problem is that sometimes my login page loses its css styling. When I look at my console logs I can see that the login page is referencing old versions of my css files.
I can see that my application cache has been updated and holds the new versions of the css files. The login page should also be loaded into the HTML5 application cache and so should have references to the new css files and not the old ones.
Is it possible that my login page is being loaded from the browser cache and not the HTML5 application cache? If so, how can I prevent this? If I clear browsing history the login page then works correctly.
My code was failing on gotcha #3 as listed in:
http://alistapart.com/article/application-cache-is-a-douchebag
I hadn't set a cache header on my aspx and html pages and so, when the manifest changed, the browser checked the pages listed in the cache manifest and guessed which ones needed to be updated. Sometimes it would decide not to update login.aspx and I would see the behaviour described above. I have now set the cache header of my pages to 'no-cache', as recommended, by adding the following to global.asax:
Protected Sub Application_BeginRequest()
Response.Cache.SetAllowResponseInBrowserHistory(False)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetNoStore()
Response.Cache.SetExpires(DateTime.Now)
Response.Cache.SetValidUntilExpires(True)
End Sub