473,407 Members | 2,546 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,407 software developers and data experts.

Response.Expires and Response.Cache

Hi, everyone...
I want to avoid the user to use the navigator back button.
For that reason, I tried all the possible ways to set the Expires property
of the Response Object, but whatever I do, it does not work for me.

In fact, it does work once, the first time I wrote these lines in the
Application_BeginRequest event of the Global.asax file:
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0 'or -1
Response.CacheControl = "no-cache"

But since I re-compiled the code, it never worked again.

I also wrote these lines everywhere:

Response.Cache.SetCacheability(HttpCacheability.No Cache)
Response.Cache.SetExpires(Now())

In the Page:
Page_Load
Page_PreRender

In the Global.asax:
Session_Start
Application_BeginRequest
Application_AuthenticateRequest
Application_Error
Session_End
Global_AcquireRequestState

I also had tried with the following code:

Response.AddHeader("Pragma", "no-cache")
Response.AddHeader("Expires", "-1")

Nothing.
I appreciate any suggestion.

Promenade
Nov 18 '05 #1
2 6938
Clear your browser cache. You may have some funky old stuff cached in there
since you've been messing around with this stuff.

Then try this code:
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Promenade" <pr******@adinet.com.uy> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi, everyone...
I want to avoid the user to use the navigator back button.
For that reason, I tried all the possible ways to set the Expires property
of the Response Object, but whatever I do, it does not work for me.

In fact, it does work once, the first time I wrote these lines in the
Application_BeginRequest event of the Global.asax file:
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0 'or -1
Response.CacheControl = "no-cache"

But since I re-compiled the code, it never worked again.

I also wrote these lines everywhere:

Response.Cache.SetCacheability(HttpCacheability.No Cache)
Response.Cache.SetExpires(Now())

In the Page:
Page_Load
Page_PreRender

In the Global.asax:
Session_Start
Application_BeginRequest
Application_AuthenticateRequest
Application_Error
Session_End
Global_AcquireRequestState

I also had tried with the following code:

Response.AddHeader("Pragma", "no-cache")
Response.AddHeader("Expires", "-1")

Nothing.
I appreciate any suggestion.

Promenade

Nov 18 '05 #2
Steve, thank you for your response. I'm sorry to say that didn´t work.
I don't even have a clue of what is happening here, maybe I'm doing
something wrong, the odd thing is that it worked once.....
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
Clear your browser cache. You may have some funky old stuff cached in there since you've been messing around with this stuff.

Then try this code:
Response.Expires = 0
Response.Cache.SetNoStore()
Response.AppendHeader("Pragma", "no-cache")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Promenade" <pr******@adinet.com.uy> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi, everyone...
I want to avoid the user to use the navigator back button.
For that reason, I tried all the possible ways to set the Expires property of the Response Object, but whatever I do, it does not work for me.

In fact, it does work once, the first time I wrote these lines in the
Application_BeginRequest event of the Global.asax file:
Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0 'or -1
Response.CacheControl = "no-cache"

But since I re-compiled the code, it never worked again.

I also wrote these lines everywhere:

Response.Cache.SetCacheability(HttpCacheability.No Cache)
Response.Cache.SetExpires(Now())

In the Page:
Page_Load
Page_PreRender

In the Global.asax:
Session_Start
Application_BeginRequest
Application_AuthenticateRequest
Application_Error
Session_End
Global_AcquireRequestState

I also had tried with the following code:

Response.AddHeader("Pragma", "no-cache")
Response.AddHeader("Expires", "-1")

Nothing.
I appreciate any suggestion.

Promenade


Nov 18 '05 #3

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

Similar topics

2
by: neurologic | last post by:
Hi there, I'm wondering if it's possible to change the content type of a HttpResponse after the call to getWriter has been made? What I'm trying to do is upload a file, and then once it has bee...
2
by: prakash | last post by:
Hi All Can anyone explain the difference between Response.Expires & Session.Timeout Regards Prakash
2
by: Greg | last post by:
Hi I'd like to stop a particular ASP page from being stored in the history so visitors cannot use their browser's back button to return to it. I've used Response.Expires = 0 along with this: ...
1
by: Jenny | last post by:
Need urgent help for an unsolved problem. In our ASP web application, we creat a Back button and if user click on this button, it execute history.go(-1) to go back to the previous page. All our...
2
by: qqq | last post by:
I need a page to be refreshed, even if the user navigates back to it with the 'Back' button in the browser. I've put "Reponse.expires=0" in the Page_load event, but the desired refresh isn't...
0
by: Timo | last post by:
After reading KB234067, I am trying to replace this: <META http-equiv="CACHE-CONTROL" content="NO-CACHE"> <META http-equiv="Pragma" content="no-cache"> <META http-equiv="Expires" content="0"> ...
0
by: PD | last post by:
I am trying to stream out a PDF file via the response object and when I execute the code it always brings up the first document that I pulled up.Even when I step through the code, I can see the new...
12
by: gigi | last post by:
How to send more than one value using response redirect? For example i can send one like this response.Redirect "pregled.asp?ime=" & strUserName but how to send two or more values? I tried...
0
by: elliott | last post by:
Hello, I'm trying to use a C# IHttpModule to install a Response filter however IIS keeps removing the Content-Encoding header from the response; but all the other headers I set stay intact. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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.