Re: Turn off caching - Please help!



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
.



Relevant Pages

  • Re: Turn off caching - Please help!
    ... In my case I have a iFrame that I load with ... > several versions of an html file. ... > inmediately' in IIS everything works ok but I want to get the same ...
    (microsoft.public.dotnet.framework.aspnet)
  • Turn off caching...still not working
    ... In order to make my question more crear I am including the general html structure of my main page: ... As you can see I have an Iframe that I load with several versions of an html file. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Download and cache page without displaying it?
    ... If the pages you are trying to preload are taking a while to load, ... the only thing left to load is the html file ... If it is not in an IFrame, ...
    (comp.lang.javascript)
  • Re: loading html pages in frames
    ... >>> On the server when we click on the link we get a momentary ... the html file loads correctly in the same window. ... >>> to load it but I get the same behaviour as trying to load from the ... >>> temp->data virtual folder. ...
    (microsoft.public.inetserver.iis)
  • Re: Window and iframe question
    ... that you so elegantly elaborated work, however, I'd prefer not to ... after each iframe have problem being executed under this application ... requires load sequence etc...). ... logic to the server then you could use Option 3 instead: ...
    (comp.lang.javascript)

Loading