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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing the Page's Cache

Status
Not open for further replies.

lsmyth1717

Programmer
Joined
Mar 25, 2005
Messages
44
Location
GB
I've found this code to help me with my session logout problem. Before I had a session and when I logged out everything worked fine and I was brought to the log out page but when i clicked the back button in IE I was brought back into the cached version of the page in IE. I added the below two lines to the page load and now the page cache is cleared and and I can check the session variable and do the nessesary.

My problem is that this doesn't seem to work in ASP.Net version 1.0. I get the following error.
'System.Web.HttpCachePolicy' does not contain a definition for 'SetAllowResponseInBrowserHistory'

Is there anything similar I can do in ASP.NET 1.0 to achieve the same thing.


//clear down the cache
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);
if (Session["UserName"].Equals(string.Empty))
{
Response.Redirect("index.aspx");
}
 
Upgrade to 1.1? [smile]

--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Sorry I can't do this. the whole project is written in 1.0 and this isn't an option unfortunately.
 
In that case could you maybe utilise the OutputCache?


--------------------------------------------------------------------------------------------------------------------------------------------

Need help finding an answer?

Try the search facility ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top