Click here to Skip to main content
11,433,220 members (61,009 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hello all Smile | :)

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 Smile | :)
Posted 12-Jan-13 14:45pm
Edited 12-Jan-13 16:20pm
Sergey Alexandrovich Kryukov at 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 at 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 at 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
Web04 | 2.8.150428.2 | Last Updated 12 Jan 2013
Copyright © CodeProject, 1999-2015
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