Solved

ASP.Net End Session

Posted on 2008-10-28
3
200 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
ID: 22826843
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
ID: 22827040
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
ID: 31510964
That was it, thank you
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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