how to prevent the ASP.NET 2.0 page being cached  
Author Message
Vivek Natani





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

Hi,

I have an ASP.NET 2.0 application and it takes the login and password to give access to related pages to only the logged in users. When the user logs out (I'm doing session.abandon, basically ending the session on the web server), he is directed to the Thank You page but when he hits the browser "Back" button he can view the earlier page (This is happening because the page is cached as the client doesn't make a request to the web server to get it).

So How can I prevent this

Thanks,

Vivek



.NET Development8  
 
 
Ely





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

When you hit the back button, what happens when you refresh the page

The cache might be stored on the users browser. Try putting this tag in the html head section to tell the browser not to cache:

<meta http-equiv="Cache-Control" content="no-cache" />



 
 
Vivek Natani





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

when I hit refresh it makes a request to the server and since the session is no longer valid the server rejects this request and redirects the user to the login page.

I have already tried this meta tag and it doesn't seem to work. I'm running my app on IE 6.0


 
 
Vivek Natani





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

I got this. You can do it by adding the following code in the page (load event) master page or all the pages which you don't be cached by the client.

Response.Cache.SetCacheability(HttpCacheability.NoCache)

- Vivek


 
 
Ely





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

Great. Thanks for posting your solution.

 
 
SYEDHANIF





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

hi

While i Press the Back button in IE/FireBox. the Page should Expire. it display like below information

Warning: Page has Expired
The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you.

To resubmit your information and view this Web page, click the Refresh button.

i don't to back again to login page,

any suggestion, please help me out of this problem

kinds regards



 
 
John Saunders





PostPosted: ASMX Web Services and XML Serialization, how to prevent the ASP.NET 2.0 page being cached Top

Since this is a question about ASP.NET Pages, inot web services, t will probably get a better answer at http://forums.asp.net.