views:

105

answers:

6

Hello, I am using ASP.net with C#.After I logout its possible to go back to pages using back button.I could fix the prob for the login.I have prob with the logout.I am using the inbuilt login page provided by the asp editor.Should I use sessions?

please help.

+1  A: 

After using the back button, try doing some process that needs login privilages. I think you are logged out already but your browser is displaying your page from the cache.

stckvrflw
+2  A: 

On all pages in your site, you need to check if the user is still logged in and if not, log them out.

You also need to make sure that the pages are not cached on the browser on anywhere else.

Oded
+5  A: 

This is a caching issue. Browser will be loading the page from cache. You can disable caching of the Home page, and check for user session in that page. By this you can avoid the problem.

See HttpCacheability Enumeration

rahul
+1  A: 

As @Rahul has identified this is a cacheability issue. Basically what is happening is when the user visits the page the browser is caching it. So regardless if the user is logged in/out, when the user selects the back button, the page being retrieved from the cache not the server.

If you want to ensure the page is always retrieved from the server (which will effectively resolve your issue) you need to set Cacheability to NoCache. See Setting the Cacheability of a Page.

James
A: 

See Login on the Web. The same principles apply.

Sinan Ünür
A: 

I used history.forward() in the header of the web page which i didn't wanted to be displayed. Its working.

pooja