0

我想将状态服务器用于 sessionState。这适用于所有会话变量,但不适用于身份验证。我必须怎么做才能将身份验证存储在 State Server 中,这样我才能使用 Web 服务器场?我的 web.config 看起来像..

 <system.web>
<authentication mode="Forms">      
  <forms loginUrl="~/Account/Login" timeout="20" slidingExpiration="true" />      
</authentication>
<authorization>
  <deny users="?" />
</authorization>

<sessionState mode="StateServer" stateConnectionString="tcpip=localhost:42424" cookieless="false" timeout="20" />
<machineKey validationKey="F2FCB9C6C8F045A198D4885C6E...
4

1 回答 1

1

我不清楚您所说的“在状态服务器中存储身份验证”是什么意思。

身份验证永远不会存储在会话变量中,这样做是一种不好的做法。身份验证以加密 cookie(非持久或持久)的形式存储在用户本地计算机上,因此只要您在所有服务器上共同指定您的机器密钥,就本质上不受任何 webfarm 问题的影响。

Session 和 FormsAuthentication 适用于 .NET 中的不同系统。

于 2013-08-05T08:30:54.260 回答