petko_stankoski
petko_stankoski

Reputation: 10723

Make Session last longer

In my web.config I have this:

<sessionState timeout="70"/>

However, after 5 minutes my session is null and my program crashes. How to make this time longer?

Here is how I initialize it:

Session["mySession"] = "blah blah";

Upvotes: 2

Views: 1709

Answers (3)

Vladi
Vladi

Reputation: 1990

the time that you putting inside the Web.Config

<sessionState timeout="60"/> (it in minutes)

affect on the

HttpContext.Current.Session.Timeout = 60

or

 System.Web.HttpContext.Current.Session.Timeout = 60

Upvotes: 0

mghaoui
mghaoui

Reputation: 573

Modify the timeout like this:

HttpContext.Current.Session.Timeout = 200000

Upvotes: 2

Ivo
Ivo

Reputation: 3436

Check the applicationpool timeout http://technet.microsoft.com/nl-nl/library/cc771956%28v=ws.10%29.aspx

Using forms authetication? It got it's own timeout/

Upvotes: 1

Related Questions