无法使用 asp.net 4 webforms 路由获取 System.Web.SessionState
我在这里看到了几个问题,例如 使用时的状态服务WebForms 中的 system.web.routing 但找不到合适的解决方案。
我在 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.
我已启用会话状态,并且如果我使用 aspx 扩展名而不是路由 url 调用页面本身,则所有内容工作正常。
有人知道如何让会话状态与路由一起工作吗?
I've seen couple of questions here such as State Service when using system.web.routing in WebForms but couldn't find proper solution.
I am using asp.net routing with webforms on iis7. I've added below to webconfig file to get it working at first palace
<system.webServer><modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
Problem is that when i use routed pages Session state is not avaliable and i get
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.
I have sesison state enabled and if i call page itself with aspx extension instead of routed url everything works fine.
Anyone know how to get session state work with routing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
知道了!请参阅 http://www.heartysoft .com/post/2010/07/26/aspnet-routing-iis7-remember-modules.aspx
got it! see http://www.heartysoft.com/post/2010/07/26/aspnet-routing-iis7-remember-modules.aspx