clear session in classic asp and asp.net(vb)

eaweb
eaweb used Ask the Experts™
on
Hi,

I have a session named session (loggedin) which verifies if a user has log in or not. My problem is when the user closes his browser and re opens it. He can access the page back without having to login again because the session still exist which is not ok.
How can i clear all the sessions when a user closes his browser?  I already know how to clear a  session when a user log out via the logout script by clicking on sign-out, but how can i do the same automatically when they close their browsers.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
do not persists cookie for session.

Commented:
open web.config

<sessionstate cookieless="true">

Commented:
for session state.

http://msdn.microsoft.com/en-us/library/h6bb9cz9(VS.71).aspx

For development first delete all cookie then test your application again after applying this chage.
Top Expert 2013
Commented:
The session will not expire implicitly on browser window close.
There are many hacks floating around the web but nothing 100%.

Check few of them here and see if any of them fits your need:
http://forums.asp.net/t/1116238.aspx
http://webdesign.ittoolbox.com/groups/technical-functional/asp-dotnet-l/how-to-expire-the-session-when-the-browser-window-is-closed-2090353

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial