【发布时间】:2010-09-14 19:46:08
【问题描述】:
我在这里看到了几个问题,例如State Service when using system.web.routing in WebForms,但找不到合适的解决方案。
我在 iis7 上使用带有 webforms 的 asp.net 路由。我已将以下内容添加到 webconfig 文件中,以使其在第一宫工作
<system.webServer><modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
问题是当我使用路由页面时,会话状态不可用,我得到了
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.
我启用了 sesison 状态,如果我使用 aspx 扩展名而不是路由 url 调用页面本身,一切正常。
有人知道如何通过路由获取会话状态吗?
【问题讨论】:
标签: asp.net routing .net-4.0 session-state