Re: Turn off caching - Please help!
- From: "Joerg Jooss" <news-reply@xxxxxxxxxxxxx>
- Date: Sat, 25 Jun 2005 22:44:12 -0700
Yas wrote:
> Hello,
> I have a similar problem. In my case I have a iFrame that I load
> with several versions of an html file. The html file that I load has
> a different content every time but is has the same name. The problem
> that I have is that it shows always the first document that I loaded
> in the iFrame. When I select the option: 'enable content
> expiration/expire inmediately' in IIS everything works ok but I want
> to get the same behavior from my code. I have tried several things
> but nothing works. I would appreciate very much any help to
> solve this problem,
>
> Thanks,
>
> Yas
> PS. here are some of the things that I have tried (in page_load):
>
> Response.Expires = -1;
> Response.ExpiresAbsolute = DateTime.Now.AddDays(-2);
> Response.CacheControl = "";
> Response.AppendHeader("Pragma", "no-cache");
>
> myframe.Page.Response.Expires = -1;
> myframe.Page.Response.ExpiresAbsolute = DateTime.Now.AddDays(-2);
> myframe.Page.Response.CacheControl = "";
> myframe.Page.Response.AppendHeader("Pragma", "no-cache");
Uh uh, this looks like a programmer in panic mode ;-)
Now for the usual answer:
There's no guarantee that a browser applies caching or expiration
instructions to locally stored pages. Still, most browsers behave this
way.
Either set the OutputCache directive on your page(s)
<%@ OutputCache Location="None" %>
or set the Cache property of the HttpResponse in your code-behind class:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Using SetNoStore() as Stephen suggested is even more rigid, but maybe
not the most infrastructure-friendly approach ;-)
Cheers,
--
http://www.joergjooss.de
mailto:news-reply@xxxxxxxxxxxxx
.
- References:
- Turn off caching - Please help!
- From: Yas
- Turn off caching - Please help!
- Prev by Date: Re: uploading xml
- Next by Date: Re: Setting the destination of an uploaded file
- Previous by thread: Re: Turn off caching - Please help!
- Next by thread: False Alarm from Forms Security Validation
- Index(es):
Relevant Pages
|
Loading