If you are hosting SSRS environment on multiple IIS servers, you will need to use a common State Server or SQL Server to store session data. In this post, I will share some tips about this scenario.
Please note that using In-Process mode or using State Server Mode in the server itself will cause session errors such as “ASP.NET Session has expired“
Tips to avoid “ASP.NET Session has expired” and other session issues
In the web.config file:
- Make sure to set
enableSessionState
toTrue
. Example:
<pages buffer="true" validateRequest="true" enableSessionState="false" enableViewState="true" viewStateEncryptionMode="Always" controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID">
- Make sure that Session State is not disabled in individual pages. If there is
enableSessionState
parameter in thePage
directive, it should be set toTrue
. Example:
<%@Page enableSessionState="true">
- Make sure there is
stateConnectionString
defined in the. IIS servers should point to a common server to store session information. A sample for the correct definition:
<sessionState mode="StateServer" stateConnectionString="tcpip=SampleStateServer:42424" cookieless="false" timeout="20"/>
- In order to set up a separate server as State Server, install .NET Framework and set the registry key below to “1”. Make sure that ASP.NET State Service is running.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnections
References:
- State Server Mode with the sample configuration
- Planning for State Server
- Step-by-step instructions to use State Server
Once you implement the session state mode correctly, you may run into another issue which is generating a new session ID in every postback. Here is the solution: ASP.NET application generates a new session ID after every postbacks