ActionExecutingContext HttpContext.Session为null [英] ActionExecutingContext HttpContext.Session is null
问题描述
我使用MVC Actionfilter(全球)来调用数据库来获得用户数据,我要尽量存储会话。
编码为<一提到href=\"http://stackoverflow.com/questions/32852440/dependency-injection-in-asp-net-session-start-method/32854222#32854222\">Dependency注射ASP.net在session_start方法。
一切工作在本地机器的罚款。
I am using MVC Actionfilter (Global) to call db to get user data and i try to store that in session. Coding as mentioned in Dependency Injection in ASP.net Session_Start method. Everything works fine in local machine.
但在生产机器,我filterContext.HttpContext.Session(filterContext是ActionExecutingContext)始终为空。
But in production machine, my filterContext.HttpContext.Session (filterContext being ActionExecutingContext) is always null.
我不知道是什么的详细信息,我可以给,但如果有人问问题,我已经准备好提供更多的答案。
I dont know what more information i can give, but if somebody asks questions I am ready to provide more answers.
请让我知道我可以检查。
Please let me know what i can check.
推荐答案
添加下面固定的问题在web.config,虽然我不知道为什么它做。
Adding the below to the web.config fixed the problem, although i dont know why it has to be done.
<system.webServer>
<modules>
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</modules>
</system.webServer>
这篇关于ActionExecutingContext HttpContext.Session为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!