大家好,
我想验证用户身份我的项目使用活动目录,花了几个小时在互联网上冲浪后我没有发现任何对我有用的东西。
I want to authenticate users in my project using active directory, after hours and hours spent surfing on the internet i didn't find anything useful for me.
如果有人可以帮我处理代码或示例我会非常感激,因为我不知道从哪里开始。
If anyone can help me with pieces of code or example i'll appreciate it a lot, because i have no idea where i can start from.
祝你好运,
Leo
推荐答案
Perhap我不明白你的意思使用AD,但如果您只是想使用Windows身份验证(这是AD是什么),那么你不需要愿意做任何事情。 Windows应用程序会自动使用它,而网络应用程序(可以在forums.asp上发布)只需将的身份验证设置为Windows。您无需编写任何代码来验证当前用户。
Perhap I don't understand what you mean by use AD but if you simply want to use Windows auth (which is what AD is) then you don't need to do anything. Windows apps use it automatically and web apps (which can be posted at forums.asp) just set the authentication to Windows. You don't need to write any code to authenticate the current user.
要访问当前Windows用户,您可以根据应用程序使用各种方法,但WindowsIdentity.GetCurrent可以使用任何地方。在其他情况下,您可以使用当前线程的主体,因为它将设置为运行应用程序的用户。
To get access to the current Windows user you can use a variety of approaches depending upon your app but WindowsIdentity.GetCurrent works anywhere. In other cases you can use the current thread's principal since it will be set to the user running the app.
更多推荐
使用Active Directory进行身份验证
发布评论