Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

In my project I want to write logout code which will work on any browser . My problem is when I login into my home page I am creating session . So in each and every page i am going to check weather session count is there (Session.Count>0) if session count is not there means i am redirecting to login screen and in Logout click i am clearing All Session (Session.Abandon()) . Is this proper way to follow what I have done .

If any suggestions are there means please suggest me .

Thanks in advance

Arun R.V
Posted

Login/out is never done using JavaScript, since it would be insecure. The server does not care what browser you use.

You can therefore use any of the tutorials on the web. I suggest you plough trough some.
 
Share this answer
 
Comments
BillWoodruff 24-Sep-12 9:45am    
ArunV wrote: "Is this proper way to follow what I have done."

What makes you think it's not the right way to do it ? What specific problem do you observe that is created by using this technique ? Are you familiar with the difference between the 'Abandon, and 'RemoveAll methods: I'm not :)
Eddy Vluggen 24-Sep-12 10:46am    
MSDN is.
I believe the proper way would be to call Session.Abandon() Method when user clicks on logout button.

Public void LogOut()
{
Session.Abandon();
}

Session.Abandon() destroys the session.
Ideally as soon as user logged out you can call the above method and then redirect again to Login page.

Regards,
Ravi
 
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