Context.User为NULL在Application_AuthenticateRequest通过在Asp.net MVC应用程序Windows验证 [英] Context.User is NULL in Application_AuthenticateRequest via windows auth in Asp.net MVC app

查看:825
本文介绍了Context.User为NULL在Application_AuthenticateRequest通过在Asp.net MVC应用程序Windows验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Context.User是Application_AuthenticateRequest空(或HttpContext.Current.User)()方法中使用MySQL的成员使用Windows身份验证我的MVC项目。

任何想法?

 保护无效Application_AuthenticateRequest()
        {
            VAR US = Context.User;
            VAR用户= HttpContext.Current.User;        }


解决方案

最有可能是因为在该MVC应用程序正在运行的应用程序池有管道模式设置为集成。如果设置为经典的它应该工作的罚款。几点说明,讨论和链接的位置:

<一个href=\"http://stackoverflow.com/questions/1663535/httpcontext-current-user-is-null-even-though-windows-authentication-is-on\">HttpContext.Current.User为null即使Windows身份验证是

Context.User is null (or HttpContext.Current.User) in Application_AuthenticateRequest() method in my MVC project that uses Windows authentication using MySql membership.

any idea?

protected void Application_AuthenticateRequest()
        {
            var us = Context.User;
            var user = HttpContext.Current.User;

        }

解决方案

Most likely it is because the Application pool in which the MVC application is running has pipeline mode set to Integrated. If you set to classic it should work fine. Some explanations, discussion and links here:

HttpContext.Current.User is null even though Windows Authentication is on

这篇关于Context.User为NULL在Application_AuthenticateRequest通过在Asp.net MVC应用程序Windows验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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