Click here to Skip to main content
12,697,076 members (29,599 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hello all :)

I used sessions at old web site to save log in data, is there a way to make user logged out after closing the browser ?

thanks in advance :)
Posted 12-Jan-13 14:45pm
Updated 12-Jan-13 16:20pm
Sergey Alexandrovich Kryukov 12-Jan-13 21:26pm
"After closing the browser" is obviously too late to do anything. :-)
Just before closing the window is possible, but you cannot rely on it.
shaikh-adil 13-Jan-13 5:26am
sir can you help me out here

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try with window.onbeforeunload java script event. It will fire before closing the browser. you can use that event to call the ajax request to force session out or redirect to the logged out page.
Sergey Alexandrovich Kryukov 13-Jan-13 12:45pm
This is correct, my 5. (I disagree with the vote of 2. At least it would need some explanation.)

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

Advertise | Privacy | Mobile
Web01 | 2.8.170118.1 | Last Updated 12 Jan 2013
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