为什么HttpContext.User中零的AuthenticateRequest完成后, [英] Why is HttpContext.User null after AuthenticateRequest is complete

查看:198
本文介绍了为什么HttpContext.User中零的AuthenticateRequest完成后,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要检查的标准方式,如果当前请求进行身份验证与 HttpContext.User.Identity.IsAuthenticated 。我刚才碰到其中用户属性为空,所以我不能让检查的情况下!

The standard way to check if the current request is authenticated is with HttpContext.User.Identity.IsAuthenticated. I have just run into a case where the User property is null so I cannot make the check!

我发现<一个href=\"http://www.iis.net/learn/application-frameworks/building-and-running-aspnet-applications/aspnet-integration-with-iis\"相对=nofollow>描述IIS请求管道的文章。我在这显然是后的 PostResolveRequestCache 的AuthenticateRequest !为什么会 HttpContext.User中仍然为空在这一点?

I found an article describing the IIS request pipeline. I'm at the PostResolveRequestCache stage which is clearly after AuthenticateRequest! Why would HttpContext.User still be null at that point?

推荐答案

FormsAuthenticationModule 未运行。我不得不手动将其添加到我的的web.config 用户不再是零。我正在调查是什么原因导致该模块不跑这里来。

The FormsAuthenticationModule was not running. I had to manually add it to my web.config and User was no longer null. I am investigating what caused the module not to run here.

这篇关于为什么HttpContext.User中零的AuthenticateRequest完成后,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆