Click here to Skip to main content
15,042,336 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear Sir,

How to clear session asp.net when browser/tab or browser window is closed in asp.net 3.5.

Bhushan Deo
Posted

There is no confirm way to achieve it. It is always possible to disconnect a browser from you session without any event/notification. For example, by turning the PC power off, sudden reboot, internet disconnects, etc..

Though you can cover few scenarios using page unload event, here:
How to end user session when browser closed[^]
CodeSnip: Handle Browser Close Event on the Server-Side[^]
   
Session.Clear();
Write in Page_unload event.
   

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