DailyCoding > Web

How not to cache a page output in ASP.NET

Explains how not to cache pages in asp.net to avoid them stored at client side
Author admin on Jul 31, 2008 11 Comments
Rate it    (Rated 3 by 5 people)
7,967 Views

[ad] Tip: Websites based on ASP.net would benefit from ASP.net hosting because it was specially designed to ensure error free work of ASP.net scripts.

In one of my post, I posted about How to cache a page output in ASP.NET, but sometime you have requirement like the page should never be cached. Every time user request a particular url it should give you fresh version of the page or file. To achieve this simply added Location="None" to the OutputCache directives.

<%@ OutputCache Location="None" VaryByParam="None" %>

Using Location="None" will tell the browser not to cache the page and hence your can prevent the page from saving on temporary internet files on client's machine. This could be useful when you don't want you pages or some particular page to be stored at client side for security reasons.

ASP.NET | Utility
 

Discussion

PP On Aug 4, 2008 05:16 PM
Word "aps.net" is mis-spelled :)

Ramesh Soni On Aug 4, 2008 07:43 PM
Corrected.. Thanks :)

samiran On Sep 7, 2008 09:55 PM
hey there i am a beginner of asp.net and wanted to learn something more day by day well this is a very good thing i came to know as its very helpful for me...
thanks buddy

Ramesh Soni On Sep 8, 2008 01:08 AM
Thanks samiran :).

gfdfgdgdgd On Jul 27, 2009 12:27 AM

gfdfgdgdgd On Jul 27, 2009 12:27 AM
sdfsf

Jack On Sep 6, 2009 10:38 PM
and we can use velocity or other cache server to help us.
http://jack-fx.com/csharp/asp-net/

watson On Feb 3, 2011 03:42 AM
@jack:
agreed man, there are some very good third party distributed cache providers are available to help the case.along with Velocity (now called as Appfabric), NCache also provides cache server.
http://www.alachisof..../ncache_express.html

Sankar On Apr 28, 2011 07:36 PM
but still my webform storing data in cache :(

guide me pls....

Sankar.M

Omar On Aug 20, 2011 11:49 AM
thaaaaaaaaaaaaaaaaaaaaax dude :)

Omar On Aug 20, 2011 11:50 AM
But man i have a question ,,, is there any configuration for the browser to make it cache the page ???????????

Leave a Comment

Name
Email Address
Web Site