Accessing Active Directory in ASP.NET?

后端 未结 5 506
[愿得一人]
[愿得一人] 2021-02-04 18:36

I use a console application to write some test code:

    /// 
    /// Returns AD information for a specified userID.
    /// 
    /         


        
5条回答
  •  梦如初夏
    2021-02-04 19:07

    If its an intranet application that uses windows authentication, then you can wrap your AD call in a impersonation-context of the user.

    Something like:

    using (((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate())
    {
        // Do your AD stuff here
    }
    

提交回复
热议问题