Monday, 2 January 2012

Logout code in Asp.net using Session

Question:-How to Logout from page with Session


Answer:-
write following code in page load event 
Response.Cache.SetNoStore();

write following code in Under Logout Button
 
        Session.Abandon();
        System.Web.Security.FormsAuthentication.SignOut();
        Session.Contents.RemoveAll();

       Response.Redirect("login.aspx");

No comments:

Post a Comment