disabling Page Cache
1. Create a new .cs file "MyHttpModule.cs"
2. Register this module in web.config
public class MyHttpModule : IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.PostRequestHandlerExecute +=new EventHandler(context_PostRequestHandlerExecute);
}
public void context_PostRequestHandlerExecute(object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
}
}
}
2. Register this module in web.config
<httpModules>
<add name="sessionmodule" type="WebApplication1.sessionmodule"/>
httpModules>
system.web>
Your all requests will automatically be skipped from caching.
Comments
Post a Comment