HighTechTalks DotNet Forums  

How to disable page caching

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss How to disable page caching in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
JessyEzzy
 
Posts: n/a

Default How to disable page caching - 12-18-2005 , 05:51 AM






I want to disable page caching so that when a user presses the browser's back
button after submitting a form, he won't be able to re-edit the form.

How can I do that?

Thanks in advance.

Reply With Quote
  #2  
Old   
Joerg Jooss
 
Posts: n/a

Default Re: How to disable page caching - 12-18-2005 , 07:59 AM






JessyEzzy wrote:

Quote:
I want to disable page caching so that when a user presses the
browser's back button after submitting a form, he won't be able to
re-edit the form.

How can I do that?
Short answer: You can't. Caching and backward navigation are
conceptually unrelated, as far as the HTTP spec is concerned.

Long answer: Many Browsers actually *do* apply caching instructions to
back/forward navigation. The standard way of disabling caching is
either to set the OutputCache directive on your page(s)

<%@ OutputCache Location="None" %>

or to set the Cache property of the HttpResponse in your code file:

Response.Cache.SetCacheability(HttpCacheability.No Cache);

(which is equivalent to the directive shown above).


Cheers,
--
http://www.joergjooss.de
mailto:news-reply (AT) joergjooss (DOT) de


Reply With Quote
  #3  
Old   
JessyEzzy
 
Posts: n/a

Default Re: How to disable page caching - 12-20-2005 , 06:09 AM



Would you please tell me what's the difference between
<%@ OutputCache Location="None" %>
And
<%@ OutputCache Duration="0" VaryByParam="none" %>



Reply With Quote
  #4  
Old   
Joerg Jooss
 
Posts: n/a

Default Re: How to disable page caching - 12-31-2005 , 08:44 AM



JessyEzzy wrote:

Quote:
Would you please tell me what's the difference between
%@ OutputCache Location="None" %
That disables caching by setting
Cache-Control: no-cache
Pragma: no-cache
Expires: -1

Quote:
And
%@ OutputCache Duration="0" VaryByParam="none" %
That's not allowed, because Duration must be greater than zero (at
least in ASP.NET 2.0). Assuming Duration is a positive integer <n>,
this sets

Cache-Control: public, max-age=<n>
Expires: <Date header value> + <n>

Thus, the page is publicly cacheable for <n> seconds.

Cheers,

--
http://www.joergjooss.de
mailto:news-reply (AT) joergjooss (DOT) de


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.