954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to close a session when I logout a page

Hi ..

i have a login page which performs some operation and finally when i log-out that page it has close all the session and navigate to the home page , but then when i click back button in IE it should not post back the page again..

thanks in advance

kamilacbe
Junior Poster in Training
77 posts since Jun 2010
Reputation Points: 10
Solved Threads: 10
 

Call the Session.Clear() method when the log out code is complete (but before the redirect to the home page). This will clear out all session values regardless of whether the back button is clicked - as long as each page checks for an active session anyway.

hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 168
 

hi .

can give me an example..because i have cleared the session before transferring my page ..but then when I click the back button it shows the data..

Thanks ...

kamilacbe
Junior Poster in Training
77 posts since Jun 2010
Reputation Points: 10
Solved Threads: 10
 

Does the page you go back to check to see if a valid session is active?
In the page load part of the page check for whatever session variable shows the user is logged in. If it exists or is set to the correct value continue to load the page. If not then redirect to the home page or login screen. Once you have cleared the session this page won't display even by pushing the back button

hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 168
 

hi hericles,

its working :-) Thank you...

kamilacbe
Junior Poster in Training
77 posts since Jun 2010
Reputation Points: 10
Solved Threads: 10
 

Hi ,

You can do this very easily.Just use session.clear() method and redirect to login page.

From
websoftcreation,jaipur

websoftcreation
Newbie Poster
6 posts since Nov 2011
Reputation Points: 4
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You