views:

54

answers:

2

My web page is still displaying a previously cached versions of the page.

I have this in the page_load event:

    Response.Clear();
    Response.Buffer = true;
    Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
    Response.Expires = -1;
    Response.CacheControl = "no-cache";
    Response.Cache.SetCacheability(HttpCacheability.NoCache);

I have this in the Page_Init:

protected void Page_Init(object Sender, EventArgs e)
{
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
}

Any idea what I might be missing?

+3  A: 

http://stackoverflow.com/questions/1930914/iis-7-force-fresh-images

Raj Kaimal
This might help. I need to test it out and confirm. Thanks for your help, Raj.
user279521
so far this seems to be working. Thanks.
user279521
A: 

Sometime you need to flush the browser. If you use IE, the tool that helps is the IE Toolbar for Developers with Fiddler.

For firefox use Firebug with Fiddler.

ggonsalv
Using IE browser only
user279521