views:

967

answers:

2

We've got a ASP.net web app with a few pages that occasionally time out as the page loads (generally, these are all admin-type pages that do bug uploads / downloads with processing.)

One of the solutions has been to bump both Session.Timeout and Server.ScriptTimeout up to very large numbers - which works fine. However, there's quite a bit of discussion here about when each setting applies. To put it mildly, the MSDN pages are open to interpretation.

Can anyone give me the reader's digest version of what the difference is, or point me to the MSDN page we couldn't find?

Thanks, all.

(.net 2.0 on II6, if it matters.)

As a bonus follow-up question, does changing those settings in, say, a given page's on_load() function change them for the whole app, or just that page?

Edit: whoops! I meant "Session.Timeout" not "Server.Timeout."

+2  A: 

ScriptTimeout is the number of seconds the ASP.NET runtime will spend waiting on results from an ASPX page.

Session.Timeout is the number of minutes ASP.NET will spend waiting on YOU.

Bryan
+3  A: 

The script timeout is what controls how long the code may run to handle a request, so that's what you change to allow for long running code. The setting in IIS Manager is used for every request, and the Server.ScriptTimeout property is used for the current request, so if possible you should set it in the code so that all the regular pages uses the normal script timeout.

The session timeout is the time that the session object on the server survives after the user last made a request. The session timeout setting in IIS Manager is the default setting for any new session created, and the Session.Timeout property that you access from the code is the timeout for that specific session. The default session timeout is 20 minutes, and you can bump it up a bit without any great risk, but you should still keep it within a reasonable value so that you don't have session objects that clings on for days in memory.

Guffa
Since the question references IIS6 is worth pointing out that the session and script timeouts in IIS manager refer to ASP not ASP.NET. To control ASP.NET timeouts one needs to edit the web.config.
AnthonyWJones