Click here to Skip to main content
13,301,553 members (92,880 online)
Rate this:
Please Sign up or sign in to vote.
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 24-Sep-12 4:15am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

I believe the proper way would be to call Session.Abandon() Method when user clicks on logout button.

Public void LogOut()

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.


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100