您的位置:首页 > 其它

【MVC2】发布到IIS7.5上后Session为null

2015-09-09 17:03 204 查看
MVC2代码「Session.IsNewSession」在VS中可以正常执行,发布到IIS7.5上之后Session为null导致出错。

if (Session.IsNewSession)
{
......
}


解决方法是在Web.config中追加如下设定:

<configuration>
<system.webServer>
<modules>
<remove name="Session"/>
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</modules>
</system.webServer>
</configuration>


参考:http://stackoverflow.com/questions/10629882/asp-net-mvc-session-is-null
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: