Alex Rivera | Logout

Changing expiry on ASP.NET's Session State cookie

Asked 2010-06-09T08:40:02.293
9

I'm using ASP.NET Session State to keep track of logged in users on my site.

However, one problem I'm running into is that by default ASP.NET session cookies are set to expire when the browser closes.

http://ahb.me/43e

I've tried setting my own ASP.NET_SessionId cookie and modifying the cookie's expiry using something similar to the following code:

Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(1);

None of these approaches work, they all set a second cookie with the same name.

Is there a way of changing the session cookie's expiry?

Edit
Report

1 Answer

1

Just a guess: Maybe editing the session.configuration inside the web.config could change the cookie-expiration? You can take a look here?

answered 2010-06-09T08:48:41.480

Your Answer