title: Dynamic session state provider
body: <p>I wish to change the session state provider dynamically when a web page loads. </p>
  
  <p>Locally, while developing, we use the following:</p>
  
  <pre><code>&lt;sessionState mode="InProc" /&gt;
  </code></pre>
  
  <p>But production code runs like this:</p>
  
  <pre><code>&lt;sessionState mode="Custom" customProvider="CustomSessionStateProvider"&gt;
    &lt;providers&gt;
      &lt;add name="CustomSessionStateProvider" type="Library.CustomSessionStateProvider" applicationName="AppName" /&gt;
    &lt;/providers&gt;
  &lt;/sessionState&gt;
  </code></pre>
  
  <p>Is it not possible to change which provider the sessionState uses at runtime before a page loads?  It would be determined by some kind of configurable item:</p>
  
  <pre><code>if(Environmental.IsProduction)
  {
      // Use custom provider
  }
  else
  {
      // Use InProc
  }
  </code></pre>
  
  <p>We do use different config files per environment, but this feature needs to be available in all environments.</p>