Disable Caching: SetNoCache vs SetCachability vs Expires vs AddHeader("pragma", "no-cache");
-
I'm a bit confused. Searching the web for a solution to disable caching, I found several answers to this question. Unfortunately, I found several different answers all containing a mix of - Response.Expires - Response.Cache.SetNoStore - Response.AddHeader("pragma", "no-cache"); - Response.Cache.SetCacheability(HttpCacheability.NoCache); And secondly the documentation in MSDN is not quite clear, what every method exactly does. Maybe someone can help me understand? Thanks in advance Urs
-^-^-^-^-^- no risk no funk ................... please vote ------>
-
I'm a bit confused. Searching the web for a solution to disable caching, I found several answers to this question. Unfortunately, I found several different answers all containing a mix of - Response.Expires - Response.Cache.SetNoStore - Response.AddHeader("pragma", "no-cache"); - Response.Cache.SetCacheability(HttpCacheability.NoCache); And secondly the documentation in MSDN is not quite clear, what every method exactly does. Maybe someone can help me understand? Thanks in advance Urs
-^-^-^-^-^- no risk no funk ................... please vote ------>
All that those commands do is to add properties to the http header of the page. Most examples is just a collection of everything ever found on the matter, setting the same properties over and over in different ways using different values overwriting each other. You just have to find out what headers you need, and set them. Maybe this is helpful: http://www.seoconsultants.com/articles/1000/cache-control.asp[^] The ultimate source (although a lot to read) on how caching works is of course the RFC: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13[^]
--- single minded; short sighted; long gone;