从自定义 MvcRouteHandler 访问 SessionState
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
}
}
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
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您遇到此问题:请参阅 http://www.heartysoft.com/ aspnet-routing-iis7-remember-modules。
解决方案是删除并重新添加会话状态模块。
另请参阅相关的SO问题:路由时HttpContext.Current.Session为空请求
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