C# accessing active directory with different user credentials

前端 未结 4 1556
盖世英雄少女心
盖世英雄少女心 2020-12-19 07:12

There is a new user creation application that we have just provided our users. However these users need the ability to creation users through the application even though the

4条回答
  •  隐瞒了意图╮
    2020-12-19 07:55

    Use the DirectoryEntry Constructor (String, String, String, AuthenticationTypes) that takes a username and password instead of impersonation.

    DirectoryEntry directoryEntry = new DirectoryEntry("IIS://" + serverName + "/W3SVC/1/Root", @"domain\username", "password", AuthenticationTypes.Secure | AuthenticationTypes.Sealing); 
    

    Reference

提交回复
热议问题