Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 304
Master Yoda Avatar asked Nov 29 '25 17:11

Master Yoda


1 Answers

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.

like image 158
Darren Avatar answered Dec 01 '25 07:12

Darren