As Maurico and codeka first stated, don't use the default InProc sessions if you don't want your sessions to be affected by website recompiles and application recycles.
A list of what causes whole website recompile:
By default, when any change is made to a top-level file in a Web site, the whole site is recompiled. Top-level files include the global.asax file and all files in the bin/ and App_Code/ folders.
modifying web.config
a configuration include file change, if the SectionInformation.RestartOnExternalChanges property is true
<section name="MyAppSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="true" requirePermission="false" />
Notes:
- If you want to be able to change top-level files without causing the whole site to be recompiled, you can set the optimizeCompilations attribute of the compilation element in the Web.config file to true
References:
Where's the info that tells the kinds of changes and files which cause a website project (not web application project) to recompile itself?
The reason I'm asking is because we don't want users to lose their sessions. Therefore we want to update the live website with recompilable changes only in the very wee hours of the morning, but would prefer to make changes during the day to expedite them. We do promote to a staging server first and watch it there, but a definitive list would be nice in advance.