473,503 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6945
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
6232
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
5655
by: prakash | last post by:
Hi All Can anyone explain the difference between Response.Expires & Session.Timeout Regards Prakash
2
5620
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
2487
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
10943
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
1137
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
2973
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
1491
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
3295
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
7207
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
7291
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
7357
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...
1
7012
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...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
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...
0
3180
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...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
402
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...

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.