ASP.NET Session server state
0Hancock posted on 2016/01/23 13:14:19
+ Start windows service "ASP.NET State service"
+ Allow to use service from far away:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection
+ Edit web.config
+ Note: all objects stored in session must be declared serialized
Share session between apps
+ Allow to use service from far away:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection
+ Edit web.config
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" timeout="30"/>
+ Note: all objects stored in session must be declared serialized
Share session between apps
protected void Application_Start(object sender, EventArgs e)
{
string applicationName = "mysiteapp";
// Change the Application Name in runtime.
FieldInfo runtimeInfo = typeof(HttpRuntime).GetField("_theRuntime",
BindingFlags.Static | BindingFlags.NonPublic);
HttpRuntime theRuntime = (HttpRuntime)runtimeInfo.GetValue(null);
FieldInfo appNameInfo = typeof(HttpRuntime).GetField("_appDomainAppId",
BindingFlags.Instance | BindingFlags.NonPublic);
appNameInfo.SetValue(theRuntime, applicationName);
}






