I need to turn off caching in my ASP.NET page. I have set the following code
in Page Load event:
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Still, sometimes the page is retreived from cache. Are there any other
options I need to set?
TIA
Rohit 13 5665
Rohit,
Which cache are you trying to disable? The caching on the server or the
caching on the client? If you are seeing cached data, it could be server-side
or client-side
Have you checked you settings within IE to see if the page is being cached
client-side?
Also, have you enabled Content Expiration within IIS for the Web you are
testing?
Finally, if you are viewing the pages through the ISA server
(firewall/proxy), then be aware that ISA could be caching the pages for you:
both INbound and OUTbound pages.
Respectfully,
Andrew Corley
"Rohit" wrote: I need to turn off caching in my ASP.NET page. I have set the following code in Page Load event:
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Still, sometimes the page is retreived from cache. Are there any other options I need to set?
TIA Rohit
Hi Rohit,
I think Andrew's suggestions are reasonable since there could be many
things that can cache the page. In spite of the asp.net serverside or IIS
's cache, if what you want to disable is just the client browser's cache,
you can try set the Response.Expire = -1 so as to make the page expire
immediatly at client side.
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Rohit,
Any further ideas or questions on this issue? If there is anything else we
can help, please feel free to post here. Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
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");
From http://www.developmentnow.com/g/8_20...ff-caching.htm
Posted via DevelopmentNow.com Groups http://www.developmentnow.com
On Fri, 24 Jun 2005 20:35:16 +0000, 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");
From http://www.developmentnow.com/g/8_20...ff-caching.htm
Posted via DevelopmentNow.com Groups http://www.developmentnow.com
Try an old trick: add a parameter that changes each time you submit
Try
Response.Cache.SetNoStore();
Stephen
"Yas" <yl******@purdue.edu> wrote in message
news:f1**********************************@msnews.m icrosoft.com... 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");
From http://www.developmentnow.com/g/8_20...ff-caching.htm
Posted via DevelopmentNow.com Groups http://www.developmentnow.com
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.No Cache);
Using SetNoStore() as Stephen suggested is even more rigid, but maybe
not the most infrastructure-friendly approach ;-)
Cheers,
-- http://www.joergjooss.de
mailto:ne********@joergjooss.de
Hello, thanks for your help but it is still not running the way I want.
I have tried:
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Intrader, you said: "Try an old trick: add a parameter that changes each time you submit". Would you give me please more detail about this trick? Where should I declare that parameter?
In order to make my question more crear I am including the general html structure of my main page:
body MS_POSITIONING="GridLayout"
form id="Form1" name="Form1" method="post" runat="server"
table width="80%" align="center"
tr
td
div id="MyFrameContainer"
SPAN id="ifrmConfigurePage1" runat="server" /SPAN
/div
/td
/tr
tr
td align="center"
INPUT id="Button1" type="button" value="Next" name="Button1" runat="server"
INPUT id="Hidden1" type="hidden" name="Hidden1" runat="server"
/td
/tr
tr
td
div id="MyFrameContainer1"
iframe id="myframe" name="myframe" frameBorder="0" width="100%" height="500%" runat="server"
/iframe
/div
/td
/tr
/table
/form
/body
As you can see I have an Iframe that I load with several versions of an html file. I Load these html files to the Iframe in the code behind.
Any suggestion will be welcome.
Thanks
Yas
From http://www.developmentnow.com/g/8_20...ff-caching.htm
Posted via DevelopmentNow.com Groups http://www.developmentnow.com
> Intrader, you said: "Try an old trick: add a parameter that changes each
time you submit". Would you give me please more detail about this trick?
Where should I declare that parameter?
When you specify the url for your html file, do it like this:
'myFile.htm?'+(new Date()).getMilliseconds()
Eliyahu
Yas wrote: Hello, thanks for your help but it is still not running the way I want. I have tried: Response.Cache.SetNoStore(); Response.Cache.SetCacheability(HttpCacheability.No Cache);
So... what happens?
Cheers,
-- http://www.joergjooss.de
mailto:ne********@joergjooss.de
Hi friends,
I am facing almost a similar problem.
But in my case, the html pages are getting cached whereas the asp pages are getting executed afresh. The problem is only with some of the html pages. And these pages are getting cached on the server(iis 5.0). Changing the HTTP header setting is of no effect!
Pls help.
Regards,
Nise
From http://www.developmentnow.com/g/8_20...ff-caching.htm
Posted via DevelopmentNow.com Groups http://www.developmentnow.com
Nise wrote: Hi friends,
I am facing almost a similar problem. But in my case, the html pages are getting cached whereas the asp pages are getting executed afresh. The problem is only with some of the html pages. And these pages are getting cached on the server(iis 5.0). Changing the HTTP header setting is of no effect!
What did you do exactly?
Cheers,
-- http://www.joergjooss.de
mailto:ne********@joergjooss.de This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jawahar Rajan |
last post by:
All,
I have a default setting of Response.Expires = 1200
is this 20 minutes? or 1200 minutes?
The problem I have is say user1 log-in to the web site,
and is a valid user, then I display on each...
|
by: R. Ian Lee |
last post by:
I have an ASP.NET page that spawns a popup window using
javascript's window.open. This works fine. It pops up,
you enter some data, press save and everything saves as
it should. But, if you...
|
by: Robert Strickland |
last post by:
I wish to turn off browser caching through some meta tags. Note the
following:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META...
|
by: Ken Varn |
last post by:
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...
|
by: DC |
last post by:
Hi,
(ASP.Net 1.1) is it possible to (programmatically and globally)
deactivate page fragment caching? We have only two scenarios,
development stage where we want caching off and testing where we...
| |
by: Chris |
last post by:
I've been playing with the fragment caching and it seems
to work fine. I have a user control that I set to
cache. The user control has a few text boxes and a drop
down list box populated from a...
|
by: Andrew Clancy |
last post by:
Okay my question last night wasnt answered - here's a simpler one:
I have a form user control, I want to cache the first page (with clientside
validation) but turn caching off whenever anyone...
|
by: Raj |
last post by:
What is the purpose of file system caching while creating a tablespace?
Memory on the test server gets used up pretty quickly after a user
executes a complex query(database is already activated),...
|
by: Raj |
last post by:
What is the purpose of file system caching while creating a tablespace?
Memory on the test server gets used up pretty quickly after a user
executes a complex query(database is already activated),...
|
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...
|
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,...
| |
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...
|
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...
|
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: 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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
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...
| |