0

我的 web.config 中有以下内容:

<system.web>
<sessionState mode="Custom" regenerateExpiredSessionId="true" customProvider="MySqlSessionStateProvider">
  <providers>
    <add name="MySqlSessionStateProvider" type="MySql.Web.SessionState.MySqlSessionStateStore, MySql.Web, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="App_Name" description="App_Description" connectionStringName="MySqlSession" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="True" />
  </providers>
</sessionState>

我在 web.config 的 ConnectionStrings 部分中定义了 MySqlSession 连接字符串。

当我运行该站点时,数据库中的会话表没有被填充。但是,如果我添加cookieless=true到 customProvider 中,会话表会被填充,但会话字符串会显示在 URL 中。我不想在 URL 中显示会话字符串,因为这会干扰我的负载均衡器。如何让 MySqlSessionStateStore 使用 cookie?

4

1 回答 1

0

我错误地识别了这个问题。我只需要将身份验证保留在我的负载均衡器中。我通过确保每个 IIS 实例上的机器密钥相同来解决这个问题。

上面列出的 sessionState 已完全删除,因为我没有在会话中存储任何自定义内容。

于 2013-05-09T19:21:00.477 回答