Solved

ASP.Net End Session

Posted on 2008-10-28
3
199 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

832 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