title: ASP.Net session is occassionally lost after postback
body: <p>We have a WebForms application that is installed at our customer:</p>
  
  <ul>
  <li>.NET Framework 4.51</li>
  <li>InProc Sessions (using Cookies)</li>
  <li>Integrated pipeline mode</li>
  <li>IIS 8.5 </li>
  <li>SSL</li>
  </ul>
  
  <p><strong>The problem</strong></p>
  
  <p>We have a problem with the session suddenly being re-created by the webserver. This is happening from time to time when an postback is made to an aspx-page. (The <code>Session.IsNewSession</code> property is set and all previous session data is lost. The ASP.Net_SessionId cookie does not change nor does the sessionId). The problem is not specific to a browser. (tested with IE, Chrome, Firefox)</p>
  
  <p>EDIT: I can now also confirm that when this occurs, not only the session of the executing user is recreated, but the session for all other active users are also recreated.</p>
  
  <p>I can neither reproduce this behavior while debugging with VisualStudio nor with my local IIS server. </p>
  
  <p><strong>What I've tried / tested</strong></p>
  
  <ul>
  <li>Checked the IIS settings for session timeout (Timeout = 20min, but the session is lost on a postback after ~ 5 seconds)</li>
  <li>App-Pool recycling is set to default values (1740 minutes)</li>
  <li>All requests are made using https:// (so no switching between http / https)</li>
  <li>Activated recycle-logging -> As far as I can see there is no app-pool-recycling when this is happening (No logs, no process-ID change, ...)</li>
  </ul>
  
  <p>What could cause this problem?</p>
  
  <p>EDIT 2: I'm now sure, that the problem is IIS 8.5. The same code running in IIS 7 does not have this problem. </p>
  
  <p><strong>The workaround</strong></p>
  
  <p><a href="https://stackoverflow.com/a/29327117/779506" title="This answer">This answer</a> solved a similar issue by setting the application pool to 'Classic' instead of 'Integrated'. I've now modified the application in a way that it can also run in 'Classic' mode and the problem is gone. I'm still looking for the cause and a "real" solution that will allow me to run the application in 'Integrated' mode. So any suggestions are still appreciated.</p>