我在 asp.net 网络应用程序中遇到问题。
我正在使用 UrlRewritingNet.UrlRewrite,只有在页面上没有使用 session 时它才能正常工作。
例如: 带有代码的简单页面 Default.aspx:
<% Session["some_value"] = "test"; %>
如果我通过地址访问它
http://somesite.net/Default.aspx
没关系,但如果我尝试
http://somesite.net/test/
我有错误:
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.
我该如何解决这个问题?
UPD: 我找到了答案 here
只需在 web.config 中添加两行
<system.webServer>
<modules>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</modules>
</system.webServer>
最佳答案
我找到了答案 here
只需在 web.config 中添加两行
<system.webServer>
<modules>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</modules>
</system.webServer>
关于c# - UrlRewriteModule.net 和 session 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1304043/