MVC .Net 3.5 に Web サイトがあります。コントローラーで以下のコードを使用する必要があります。だから私は名前空間を参照しています
System.DirectoryServices.AccountManagement
そして、私はエラーを受け取ります:
Error 1 The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)
不足しているアセンブリとプロジェクトに追加する方法を教えてください。
// set up domain context
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
// find a user
UserPrincipal user = UserPrincipal.FindByIdentity(ctx, "SomeUserName");
if (user != null)
{
// do something here....
string givenName = user.GivenName;
}