Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hii to all, iam developing a login page,whear user can register and can login to my page,up to this i have done, hear i want to provide a logout button for user to get back to his previous page i.e Home page, can u please send me the code for logout..thanks in advance


with regards
D Ramu
Posted
Comments
AmitGajjar 10-Dec-12 3:01am    
Noone will give you the code, what you can do is. Do some selfwork and if you have any issue then post your question.

Assuming you are using Membership (and if you aren't, you should), try:
C#
FormsAuthentication.SignOut();
 
Share this answer
 
If you're using Session :
C#
Session.Abandon();
Response.Redirect("home.aspx");

or else Solution #1 is correct as well..
 
Share this answer
 
Session.Clear();
Session.Abandon();
Response.Redirect("Home.aspx");
 
Share this answer
 
v2

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