Click here to Skip to main content
15,942,710 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
FormsAuthentication.SignOut();
        Session.Clear();
        Response.Redirect("login.aspx", true);



this code is not killing the cookie. when i go back. user is still loged in.. what is the problem
Posted

1 solution

hi,

cookies are not killed by using that statement you just clearing session variables.

that is enough for avoid entering unloggedin persons.
offcourse the previous pages are shown in browser if you click on back button but user can't do anything with those pages after logged out.

If you want to clear cookies you've to set cookie expiretime to -1 like

C#
 Response.Cookies[0].Expires.AddDays(-1);
Response.redirect("login.aspx");


the above code 'll kill all cookies regarding that website.


I hope u'll understand what I said
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900