Solved

ASP.Net End Session

Posted on 2008-10-28
3
197 Views
Last Modified: 2012-05-05
How can i end the user session when the browser closes. I have noticed sometimes when i close the browser and reopen it still shows me as logged in but all my session variables are gone. How can i do one of the following

Keep the seession objects or log the user out so they have to log back in.

Thanks
0
Comment
Question by:jimseiwert
3 Comments
 
LVL 20

Expert Comment

by:Juan_Barrera
Comment Utility
Hi,
You can set both Session and Authentication time outs to the same value, like the following:

In web.config:

<sessionState mode="YourValue" timeout="30" />
<authentication mode="Forms">
          <forms timeout="30" moreValues="","","" />
</authentication>
0
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
Comment Utility
Are you using Forms authentication? If so, when you save your auth cookie, SetFormsAuthCookie(), set persistent cookie to false. Then, when they close the browser the cookie is gone and they will have to log in again. The syntax is very close to this: SetFormsAuthenticationCookie(cookie, false);
0
 
LVL 2

Author Closing Comment

by:jimseiwert
Comment Utility
That was it, thank you
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now