473,887 Members | 2,304 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I urn off browser caching for all aspx pages?

Is there anyway within my web application that I can have all browser
caching turned off for all aspx pages sent by my IIS server? I need to have
all caching off in order for certain things to work properly, and I can't
always rely on the user disabling their cache settings at the browser level.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
Nov 19 '05 #1
12 1659
Use pragma no-cache

--

Thanks,
Yunus Emre ALPÖZEN
BSc, MCAD.NET

"Ken Varn" <nospam> wrote in message
news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Is there anyway within my web application that I can have all browser
caching turned off for all aspx pages sent by my IIS server? I need to
have
all caching off in order for certain things to work properly, and I can't
always rely on the user disabling their cache settings at the browser
level.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Nov 19 '05 #2
Use pragma no-cache


Just to clarify:

<META HTTP-EQUIV="pragma" Content="nocach e">

.....in your HTML/ASPX file.

Jeppe Jespersen
Denmark

Nov 19 '05 #3
Unfortunately, using :
<META HTTP-EQUIV="pragma" Content="nocach e">
doesn't work too good in some browsers.

The correct object to use is :

SetCacheability (HttpCacheabili ty.NoCache)


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
=============== =======

"Jeppe Jespersen" <jdj*jdj-dk> wrote in message
news:OE******** ******@TK2MSFTN GP09.phx.gbl...
Use pragma no-cache


Just to clarify:

<META HTTP-EQUIV="pragma" Content="nocach e">

....in your HTML/ASPX file.

Jeppe Jespersen
Denmark

Nov 19 '05 #4

The correct object to use is :

SetCacheability (HttpCacheabili ty.NoCache)


Agreed.

Perhaps even accompanied by:
SetAllowRespons eInBrowserHisto ry(false)

Jeppe Jespersen
Denmark

Nov 19 '05 #5
note: these are all hints to the browser (and proxy servers) and may be
ignored.

-- bruce (sqlwork.com)
"Jeppe Jespersen" <jdj*jdj-dk> wrote in message
news:OS******** ******@TK2MSFTN GP12.phx.gbl...

The correct object to use is :

SetCacheability (HttpCacheabili ty.NoCache)


Agreed.

Perhaps even accompanied by:
SetAllowRespons eInBrowserHisto ry(false)

Jeppe Jespersen
Denmark

Nov 19 '05 #6
Hmm...

SetAllowRespons eInBrowserHisto ry(false) is the default.

You only need to set
HttpCachePolicy .SetAllowRespon seInBrowserHist ory
when you need to set it to true ( to override the NoCache setting ).


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
=============== =======

"Jeppe Jespersen" <jdj*jdj-dk> wrote in message
news:OS******** ******@TK2MSFTN GP12.phx.gbl...

The correct object to use is :

SetCacheability (HttpCacheabili ty.NoCache)


Agreed.

Perhaps even accompanied by:
SetAllowRespons eInBrowserHisto ry(false)

Jeppe Jespersen
Denmark

Nov 19 '05 #7
Thanks for all of the information on this post. I take it that there is no
global way to turn caching off for the entire ASP.NET application? It would
be nice if there was something in web.config where I could turn off caching
for the whole application.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Ken Varn" <nospam> wrote in message
news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Is there anyway within my web application that I can have all browser
caching turned off for all aspx pages sent by my IIS server? I need to have all caching off in order for certain things to work properly, and I can't
always rely on the user disabling their cache settings at the browser level.
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Nov 19 '05 #8
I really hesitated before writing this, since tinkering
with basic functionality could have unexpected results.

You could try disabling the entire OutputCache module.

The OutputCache is a module which is added to ASP.NET's
core via a line in machine.config' s httpmodules section :
<httpModules>
<add name="OutputCac he" type="System.We b.Caching.Outpu tCacheModule" />

You could *experiment* removing that line.
You might have to make other adjustments, too.

Disclaimer: if you do this, you do it on your own behalf.
I do not accept any responsibility for unexpected results.

Good luck, if you decide to experiment with this.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
=============== =======

"Ken Varn" <nospam> wrote in message news:eS******** ******@TK2MSFTN GP12.phx.gbl...
Thanks for all of the information on this post. I take it that there is no
global way to turn caching off for the entire ASP.NET application? It would
be nice if there was something in web.config where I could turn off caching
for the whole application.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Ken Varn" <nospam> wrote in message
news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Is there anyway within my web application that I can have all browser
caching turned off for all aspx pages sent by my IIS server? I need to

have
all caching off in order for certain things to work properly, and I can't
always rely on the user disabling their cache settings at the browser

level.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------


Nov 19 '05 #9
I tried another approach that seems to work, but please verify.

I modified the global.asax.cs file an added the
SetCacheability (HttpCacheabili ty.NoCache) call in the
Application_Beg inRequest event.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:Or******** ******@tk2msftn gp13.phx.gbl...
I really hesitated before writing this, since tinkering
with basic functionality could have unexpected results.

You could try disabling the entire OutputCache module.

The OutputCache is a module which is added to ASP.NET's
core via a line in machine.config' s httpmodules section :
<httpModules>
<add name="OutputCac he" type="System.We b.Caching.Outpu tCacheModule" />

You could *experiment* removing that line.
You might have to make other adjustments, too.

Disclaimer: if you do this, you do it on your own behalf.
I do not accept any responsibility for unexpected results.

Good luck, if you decide to experiment with this.


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espaņol
Ven, y hablemos de ASP.NET...
=============== =======

"Ken Varn" <nospam> wrote in message

news:eS******** ******@TK2MSFTN GP12.phx.gbl...
Thanks for all of the information on this post. I take it that there is no global way to turn caching off for the entire ASP.NET application? It would be nice if there was something in web.config where I could turn off caching for the whole application.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Ken Varn" <nospam> wrote in message
news:uv******** ******@TK2MSFTN GP10.phx.gbl...
Is there anyway within my web application that I can have all browser
caching turned off for all aspx pages sent by my IIS server? I need to

have
all caching off in order for certain things to work properly, and I can't always rely on the user disabling their cache settings at the browser

level.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------



Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3276
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" http://www.tonymarston.co.uk/php-mysql/backbuttonblues.html -- Tony Marston http://www.tonymarston.net
0
2146
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. After looking at the use of the OutputCache directive and tinkering with it a bit I found its usability.very limited. Think of it: it is okay for static content. Well that's nice but no big deal. Static content is cheap anyway, the file system...
0
1747
by: Troy Simpson | last post by:
Hi, I have a website which is made up of dynamic pages. Each page that's loaded has some code which looks at which template to load amongst other things, which causes the page to take a little while to be processed. At the moment I have programmatic page caching in the "loader" using paramater caching to send a cached version of every requested page back to the user. How can I get particular elements inside each page to cache without...
10
1440
by: Jon Maz | last post by:
Hi, My goal is to take the entire html/javascript stream spat out by .aspx pages and save them as simple strings in a database (for caching purposes). I'm not sure how I can get hold of this html stream, though - does anyone have any strategies / code samples to get me going? Thanks,
3
1444
by: Joe Fallon | last post by:
I have a page in ASP.Net 1.1 which contains an image control. I set the ImageUrl property = "MyImageViewerPage.aspx" This page acts as an image handler. I have an array of bytes which I send to the browser using BinaryWrite. e.g. Response.ContentType = mVar.contenttype Response.BinaryWrite(mVar.MyBytes)
3
2950
by: Purti Malhotra | last post by:
Hi All, In our Web hosting environment we are using Virtual hosting i.e. multiple websites are on one server and multiple domains are pointing to a single website. Issue: We have two domains say “www.Test1.com” and “www.Test2.com” pointing to a single website. Website content is located onto UNCPath i.e. remote location. Domain 1: www.Test1.com points to \\servername\websitefolder\homedirectory
11
12137
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> This tags are part of the <headelement. Sample code that I have seen shows how to add metatags of the form:
1
4880
by: Nalaka | last post by:
I had ..... <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" %> Then I added "browser" <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" VaryByCustom="browser" %> After I added browser... it stopped caching pages.... is there an explanation or... did I observe the problem wrong?
2
2850
by: =?ISO-8859-1?B?UOVsIEEu?= | last post by:
Have a "standard" asp.net web solution which uses the standard asp.net authentication and authorization methods (forms authentication). Some users have raised concern that even if you logout (which brings the user back to the login.aspx page) you can seemingly navigate back in via the back-button and the browser history. If user A is viewing a page and then clicks logout and leaves (browser not at login.aspx). User B comes along and...
0
11173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10877
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10434
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7143
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5810
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4239
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.