Master Yoda
Master Yoda

Reputation: 4402

Asp.net session timeouts

Can anyone tell me why the session clears itself automatically after a certain amount of time in my application?

I use the following line to create a session variable to pass data between classes:

string data = TextBox.Text Session["Data"] = data;

After around 10 - 15 minutes i refresh the page to find that the session cache has been cleared and my application collapses on itself.

Is there a way to extend the session time in web.config?

Im not fully aware of how powerful Session's can be so any help would be great guys thanks

Upvotes: 3

Views: 213

Answers (1)

Darren
Darren

Reputation: 70728

Look in your web.config file and see the sessionState section:

<configuration>
  <system.web>
     <sessionState timeout="30"></sessionState>
  </system.web>
</configuration>

I have changed it to 30 to extend the Sessions life for an additional 15minutes. You can change this to suit your requirements.

Upvotes: 3

Related Questions