While working on moving my companies data center from Texas to California we ran across an issue with IIS 7 on Windows 2008 because we were using the ASPState database to handle session state.
If you’re like me you probably upgrade when you have the chance. If you’re like my company you don’t run just one website per server. In our case this cluster of web servers runs 6 different sites, and the session state for one of them keeps resetting just about every page view.
Apparently one of the values which is used to create the session id is the ID number of the website in IIS. Up through IIS 6 this number was a hash of the name of the site, so as long as the sites all had the same name you were set. In IIS 7 this ID number is now just a running number based on the order you create the websites in. So if you create the websites in a different order on one or more machines then your ASPState information will keep expiring since the hash values don’t match correctly.
The good news is that you can change the ID number by clicking the Advanced Settings link on the right hand side.