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

后端 未结 4 1202
夕颜
夕颜 2020-12-15 18:56

In IIS7 under Windows Server 2008, I have a virtual directory with anonymous access off and Windows authentication on. In my web.config, I have:



        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-15 19:09

    With IIS 7 and asp.net 4.0 the user was still null within Application_AuthenticateRequest() (object sender, EventArgs e). I had to place all authentication logic within the Application_PostAuthenticateRequest() (object sender, EventArgs e). You can see an example here context-user-is-null-in-application-authenticaterequest-via-windows-auth-in-asp

提交回复
热议问题