How to end the session completly

Posted by Er.deepakdalal under Regular Expressions on 4/27/2010 | Views : 1579 | Status : [Member] | Replies : 3
Hi friends................

Can you help me out, i am making a web application and in which i am making the session for different user's now please tell me how i am end my session and clear all the values in the session variables or stop the back button function also by which user again get access the application without entering the user name and password




Responses

Posted by: Muhilan on: 4/27/2010 [Member] Starter

Up
0
Down
while user logout use session.abandon();

on every page_load event check whether the user login correctly from login page

for ex..

after login successfully store the username in Session

Session("UserName")= "username";

on Page_Load event check the session have values

 If Session("UserName") = "" Then

Session.Abandon()
Response.Redirect("../loginpage.aspx")
End If


Back Button disable

use server side code on page_load event it will disable your back and forward button in client browser

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.Cache.SetAllowResponseInBrowserHistory(false);




Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 4/28/2010 [Member] Bronze

Up
0
Down
Hi,

By using the below metod u can kill all the live sessions at any instance.

Session.Abandon();

Thanks
Pavan Kumar
Mark Answer if this fits the need

Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naveenmanam on: 4/28/2010 [Member] Starter

Up
0
Down
use this method
Session.Abandon();


NaveenKumar

Er.deepakdalal, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response