简体   繁体   English

ASP.NET Web界面的C#Windows身份验证

[英]c# windows authentication for a asp.net web interface

I need to do windows authentication for a web interface asp.net. 我需要对Web界面asp.net进行Windows身份验证。
I have set up config authentication mode equal to windows. 我已经设置了等于Windows的配置身份验证模式。

For windows authentication, we need to set up only this: 对于Windows身份验证,我们只需要设置以下内容:
- <authentication mode="Windows" /> - <authentication mode="Windows" />

and in IIS we need to: 在IIS中,我们需要:
-remove anonymous access -删除匿名访问
-check integrated windows authentication. -检查集成的Windows身份验证。

Do we need to any other thing for windows authentication? Windows身份验证是否需要其他任何东西?
How to get username for validating in c#? 如何获取用于C#验证的用户名?

Thanks 谢谢

No, nothing else is required for windows authentication (assuming you only need authentication and not impersonation) in an asp.net application. 不,在asp.net应用程序中Windows身份验证不需要任何其他操作(假设您只需要身份验证而不是模拟)。 You can now get the user's identity from 您现在可以从以下位置获取用户的身份

(WindowsIdentity)HttpContext.Current.User.Identity;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM