Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Page Expired

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
0
0
US
ASP.NET Using VB

I am trying to set a page to expire if the back button is pressed..I cant get the code to fire off..I have waited aeveral minutes and the page still wont expire..

Response.Expires = -100;
Response.AddHeader("pragma","no-cache");

Thanks for your help

 
Hi,
I have the similar thing to b implemented.All the pages of the application are supposed to b expired.i had written the following code in global.asax.

protected void Application_BeginRequest(Object sender, EventArgs e)
{
// Fires at the beginning of each request
//this help you out in getting refreshed page always
Response.Buffer = true;
Response.Expires = -1000;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.AddHeader("pragma", "no-cache");
Response.AddHeader("cache-control", "private");
Response.CacheControl = "no-cache";
}



try this.i hope it will give u the desired result.


Rakhi
 
I am using VB.NET..

I tryed putting the code here in the global.asax

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
Response.Buffer = True
Response.Expires = -1000
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1)
Response.AddHeader("pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
End Sub


No luck still wont fire off..

 
I take that back...I think the code is working..I am just not getting the page that displays "WARNING: PAGE EXPIRED"



 
Yea - that warning is displayed if you try to re-view a page that was the response from a POST request. Those are annoying. what you have now is that the page will always be refershed (another GET request issued by the browser) when you go back to it.

Greetings,
Dragonwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top