disabling Page Cache

1. Create a new .cs file "MyHttpModule.cs"

    public class MyHttpModuleIHttpModule
    {

        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

Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Conflict Serializability in database