?
Solved

ASP.Net End Session

Posted on 2008-10-28
3
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

765 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