【问题标题】:Accessing SessionState from custom MvcRouteHandler从自定义 MvcRouteHandler 访问 SessionState
【发布时间】:2011-06-23 08:51:44
【问题描述】:
public class CustomRoutingHandler : MvcRouteHandler
{
  protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
  {

     requestContext.HttpContext.Session is NULL;
     //Is there any way to access Session from there ?

     return FindHttpHandler(requestContext);
     // In created handler Session is not null
  }
}

【问题讨论】:

标签: asp.net-mvc asp.net-mvc-routing


【解决方案1】:

也许您遇到了这个问题:请参阅http://www.heartysoft.com/aspnet-routing-iis7-remember-modules

解决方法是移除并重新添加会话状态模块。

另请参阅相关的 SO 问题:HttpContext.Current.Session is null when routing requests

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-24
    • 2018-09-21
    相关资源
    最近更新 更多