多个WEB共享SESSION的mode="StateServer"问题
1.先建立两个站点A与B,
A的http://10.66.13.254/SessionLogin/Login.aspx
B的http://10.66.13.254/SessionUser/User.aspx
2.两个的web.config
<sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
cookieless="false"
timeout="20" />
或者两个都是
<sessionState
mode="StateServer"
stateConnectionString="tcpip=10.66.13.254:42424"
cookieless="false"
timeout="20" />
3.启动ASPState服务
4.修改Session服务器注册表中的项 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services \aspnet_state\Parameters中的AllowRemoteConnection 键的值为1,其中的Port值为 42424 ;修改后需要重启ASP.NET State Service;
在A站点设置了
Session["UserName"] = Value
B站点的值还是为空
Session["UserName"] == null ? "the session is null!" : Session["UserName"].ToString();