473,657 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Expire s 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_Beg inRequest event of the Global.asax file:
Response.Buffer = True
Response.Expire sAbsolute = Now().Subtract( New TimeSpan(1, 0, 0, 0))
Response.Expire s = 0 'or -1
Response.CacheC ontrol = "no-cache"

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

I also wrote these lines everywhere:

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache)
Response.Cache. SetExpires(Now( ))

In the Page:
Page_Load
Page_PreRender

In the Global.asax:
Session_Start
Application_Beg inRequest
Application_Aut henticateReques t
Application_Err or
Session_End
Global_AcquireR equestState

I also had tried with the following code:

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

Nothing.
I appreciate any suggestion.

Promenade
Nov 18 '05 #1
2 6959
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.Expire s = 0
Response.Cache. SetNoStore()
Response.Append Header("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******@adine t.com.uy> wrote in message
news:%2******** ********@TK2MSF TNGP12.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_Beg inRequest event of the Global.asax file:
Response.Buffer = True
Response.Expire sAbsolute = Now().Subtract( New TimeSpan(1, 0, 0, 0))
Response.Expire s = 0 'or -1
Response.CacheC ontrol = "no-cache"

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

I also wrote these lines everywhere:

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache)
Response.Cache. SetExpires(Now( ))

In the Page:
Page_Load
Page_PreRender

In the Global.asax:
Session_Start
Application_Beg inRequest
Application_Aut henticateReques t
Application_Err or
Session_End
Global_AcquireR equestState

I also had tried with the following code:

Response.AddHea der("Pragma", "no-cache")
Response.AddHea der("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.ne t> wrote in message
news:OB******** ******@TK2MSFTN GP09.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.Expire s = 0
Response.Cache. SetNoStore()
Response.Append Header("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******@adine t.com.uy> wrote in message
news:%2******** ********@TK2MSF TNGP12.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_Beg inRequest event of the Global.asax file:
Response.Buffer = True
Response.Expire sAbsolute = Now().Subtract( New TimeSpan(1, 0, 0, 0))
Response.Expire s = 0 'or -1
Response.CacheC ontrol = "no-cache"

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

I also wrote these lines everywhere:

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache)
Response.Cache. SetExpires(Now( ))

In the Page:
Page_Load
Page_PreRender

In the Global.asax:
Session_Start
Application_Beg inRequest
Application_Aut henticateReques t
Application_Err or
Session_End
Global_AcquireR equestState

I also had tried with the following code:

Response.AddHea der("Pragma", "no-cache")
Response.AddHea der("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
6236
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 uploaded write some HTML to the screen indicating that the upload is complete. Any ideas anyone? e.g.
2
5663
by: prakash | last post by:
Hi All Can anyone explain the difference between Response.Expires & Session.Timeout Regards Prakash
2
5629
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: Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" Response.Expires = -1
1
2506
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 users use IE 6.0 and most of them don't have problem with this button. But one user reported everytime he click on this button, there is a pop-up window shows up and ask him refresh and reload the page, after he clicks OK, the previous page will be...
2
10956
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 happening. Of course it does refresh if the user hits F5. Why? (When I do View/Source from the browser to look at the html, there's no reference to "Expires"). Thanks, Paul.
0
1158
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"> with corresponding Response.AppendHeader() calls in the code-behind, because of the KB's admonition "Note that the use of standard HTTP headers are much preferred over META tags...There is at least one known problem with the Pragma HTTP-EQUIV...
0
2981
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 values in theData string array (see code below), but it serves up the first document that I had run this code with. I streamed theData into a text file to look at the values and it contained the appropriate ones for the new document. Even when I...
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 response.Redirect("pregled.asp?ime=" & strUserName & " & prezime = " & strUserLastName) but it didn't work.
0
3306
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. So far I have tested my code on IIS 5.1, 6.0 and ASP.NET Development Server/9.0.0.0 all with the same result. Does anyone have any suggestions?
0
8827
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
8732
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
8503
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
7333
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6167
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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
4158
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
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1620
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.