开发者

Accessing SessionState from custom MvcRouteHandler

开发者 https://www.devze.com 2023-03-15 07:42 出处:网络
public class CustomRoutingHandler : MvcRouteHan开发者_C百科dler { protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
public class CustomRoutingHandler : MvcRouteHan开发者_C百科dler
{
  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
  }
}


Perhaps you are encountering this issue: see http://www.heartysoft.com/aspnet-routing-iis7-remember-modules.

The solution is to remove and add session state module again.

Also see the related SO question: HttpContext.Current.Session is null when routing requests

0

精彩评论

暂无评论...
验证码 换一张
取 消