473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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 1619
Use pragma no-cache

--

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

"Ken Varn" <nospam> wrote in message
news:uv**************@TK2MSFTNGP10.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="nocache">

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

Jeppe Jespersen
Denmark

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

The correct object to use is :

SetCacheability(HttpCacheability.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**************@TK2MSFTNGP09.phx.gbl...
Use pragma no-cache


Just to clarify:

<META HTTP-EQUIV="pragma" Content="nocache">

....in your HTML/ASPX file.

Jeppe Jespersen
Denmark

Nov 19 '05 #4

The correct object to use is :

SetCacheability(HttpCacheability.NoCache)


Agreed.

Perhaps even accompanied by:
SetAllowResponseInBrowserHistory(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**************@TK2MSFTNGP12.phx.gbl...

The correct object to use is :

SetCacheability(HttpCacheability.NoCache)


Agreed.

Perhaps even accompanied by:
SetAllowResponseInBrowserHistory(false)

Jeppe Jespersen
Denmark

Nov 19 '05 #6
Hmm...

SetAllowResponseInBrowserHistory(false) is the default.

You only need to set
HttpCachePolicy.SetAllowResponseInBrowserHistory
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**************@TK2MSFTNGP12.phx.gbl...

The correct object to use is :

SetCacheability(HttpCacheability.NoCache)


Agreed.

Perhaps even accompanied by:
SetAllowResponseInBrowserHistory(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**************@TK2MSFTNGP10.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="OutputCache" type="System.Web.Caching.OutputCacheModule" />

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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP10.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(HttpCacheability.NoCache) call in the
Application_BeginRequest event.

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

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:Or**************@tk2msftngp13.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="OutputCache" type="System.Web.Caching.OutputCacheModule" />

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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP10.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
Great idea!

That will, in effect, act as a global directive since the
Application_BeginRequest event is called in all requests.

Congratulations on your smart move!

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:O1**************@TK2MSFTNGP15.phx.gbl...
I tried another approach that seems to work, but please verify.

I modified the global.asax.cs file an added the
SetCacheability(HttpCacheability.NoCache) call in the
Application_BeginRequest event.

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

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:Or**************@tk2msftngp13.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="OutputCache" type="System.Web.Caching.OutputCacheModule" />

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**************@TK2MSFTNGP12.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**************@TK2MSFTNGP10.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 #11
Yunus Emre ALPÖZEN [MCAD.NET] wrote:
Use pragma no-cache


That's almost useless. Use true HTTP 1.1 features to prevent caching
(not that browsers need to honor them anyway).

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #12
Bruce Barker wrote:
note: these are all hints to the browser (and proxy servers) and may
be ignored.


True for browsers (unfortunately), but proxies? The HTTP 1.1 spec has
MUST NOT written all over sections 14.9.1 and 14.9.2 ;-)
Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 19 '05 #13

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

Similar topics

21
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" ...
0
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. ...
0
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...
10
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...
3
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...
3
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...
11
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...
1
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"...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.