title: Server.ScriptTimeout setting global in scope?
body: <p>In all my experience, both as a Classic ASP and ASP.NET deveoper, I've always understood that calls to set the <code>Server.ScriptTimeout</code> value were local in scope to the current request.  In other words, calling <code>Server.ScriptTimeout = 600</code> would set the processing time for the current request to 10 minutes.  Subsequent or even concurrent requests to other resources will utilize the default setting for <code>Server.ScriptTimeout</code>.</p>
  
  <p>Recently in a code review, I was informed that setting <code>Server.ScriptTimeout</code> to a value sets the processing time for <em>every</em> page in the site, until the application pool is recycled.  The suggested "fix" was something like the following:</p>
  
  <pre><code>public class MyPage : Page {
    private const int desiredTimeout = 600;
    private int cachedTimeout;
  
    private void Page_Load(object sender, EventArgs e) {
      // cache the current timeout in a private store.
      cachedTimeout = Server.ScriptTimeout;
      Server.ScriptTimeout = desiredTimeout;
    }
  
    private void Page_Unload(object sender, EventArgs e) {
      // restore the previous setting for the timeout
      Server.ScriptTimeout = cachedTimeout;
    }
  }
  </code></pre>
  
  <p>This seems strange to me, as a developer calling <code>Server.ScriptTimeout = 1</code> in a page could bring down the site as every other page will only be allowed to process for one second.  Additionally, this behaviour would affect any current requests that may occur between the current Page_Load and Page_Unload events - which seems like a concurrency nightmare.</p>
  
  <p>To be thorough, however, I made a test harness consisting of two pages - <strong>Page One</strong> that sets <code>Server.ScriptTimeout</code> to some really high number and <strong>Page Two</strong> that simply displays the current value for <code>Server.ScriptTimeout</code>.  No matter what value I set on <strong>Page One</strong>, <strong>Page Two</strong> always shows the default value.  So, my test appears to verify that <code>Server.ScriptTimeout</code> is local in scope.</p>
  
  <p>I did note that if my web.config has debug="true", <code>Server.ScriptTimeout</code> has no effect - and MSDN states this explicitly on their page.  In this mode, all calls to read the value for <code>Server.ScriptTimeout</code> return an absurdly large number, no matter what I set it to.</p>
  
  <p>So my question is, and to be absolutely sure that I am not missing something, is there an instance that setting a value for <code>Server.ScriptTimeout</code> affects the processing time for the <em>entire site</em> (global in scope), or is my belief valid that the effect is local only to the <em>current context</em>?  I've Googled this question to no avail, and MSDN appears to be silent on the issue.</p>
  
  <p>Any links and/or experiences - one way or another - will be greatly appreciated!  Documentation covering this seems scarce, and I would appreciate any authoritative information.</p>