Tuesday, January 18, 2011

Stopping IIS 6 Caching

One issue that I faced when deploying an ASP.NET 3.5 web application on IIS 6 (Windows Server 2003), was that web-pages always showed old data.

For example a GridView didn't show inserted or updated data unless we refresh the page (F5). Or if we restart IIS (iisreset).

After some googling it was apparent that this is an IIS6 issue.
And every try to solve it by setting caching and expiration settings in IIS 6 failed.

The only solution we found working is to hardcode the following in Global.asax

protected void Application_EndRequest(Object sender, EventArgs e)
{
HttpContext.Current.Response.CacheControl = "no-cache";
}

6 comments:

Anonymous said...

Thank you very much for your content relating to this topic, it absolutely was very useful.

Anonymous said...

Hi,

I begin on internet with a directory

Anonymous said...

Many thanks for sharing this particular good post with an above average theme, this form of excellent natural talent you have.

Anonymous said...

Good effort. At all times keep blogging!

Anonymous said...

Outstanding information. We've definitely learned something new here! Thanks.

Anonymous said...

hi, new to the site, thanks.