Site wide caching in ASP.NET 1.x
ASP.NET supports a feature known as caching. This is where the output of the page is stored in memory, for a short period of time until it is requested again, providing a performance boost. Expecially in IIS6/Win 2003 with it’s kernel mode HTTP.sys implementation.
Implementing this in ASP.NET 1.x would generally mean adding the page directive
<%@OutputCache Duration="5" VaryByParam="none" %> to each page.
Which could be a big job if it is being fitted retrospectively to a large website.
However, it can be added to the Global.asax thus:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpContext Context = HttpContext.Current;
HttpResponse resp = Context.Response;
resp.Cache.SetExpires(DateTime.Now.AddSeconds(60));
resp.Cache.SetCacheability(HttpCacheability.Server);
}
In asp.net 2.0 this can be added as a parameter in the web.config.