Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);
While searching for authentication, I found the above two lines written. What do they mean?
What I found out by a hard way and a day of the research that having Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache)
in Global.asax.cs
file:
protected void Application_PreSendRequestHeaders(Object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
}
helps handling refreshing pop up window with a new data in IE browser.
Setting that, invokes a controller second time the pop up window is opened and refreshes the data inside from the server.
Hope it will help someone.
HttpCachePolicy.SetCacheability Method
NoCache: Sets the Cache-Control: no-cache header. Without a field name, the directive applies to the entire request and a shared (proxy server) cache must force a successful revalidation with the origin Web server before satisfying the request. With a field name, the directive applies only to the named field; the rest of the response may be supplied from a shared cache.
HttpCachePolicy.SetAllowResponseInBrowserHistory Method
When HttpCacheability is set to NoCache or ServerAndNoCache the Expires HTTP header is by default set to -1; this tells the client not to cache responses in the History folder, so that when you use the back/forward buttons the client requests a new version of the response each time.
The first one tells the browser not to cache this page (see here), and the second one tells the browser not to include this page in the browse history (see here).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With