C# 用于传输到SecurityIdentifier的System.Security.Principal.NTAccount的语法正确
我想创建一个System.Security.Principal.NTAccount对象,以便为System.Security.Principal.SecurityIdentifier传输它,这样我就可以使用它在.Net C中向Active Directory添加新的访问规则# 如果我使用此格式:C# 用于传输到SecurityIdentifier的System.Security.Principal.NTAccount的语法正确,c#,.net,active-directory,directoryservices,principalcontext,C#,.net,Active Directory,Directoryservices,Principalcontext,我想创建一个System.Security.Principal.NTAccount对象,以便为System.Security.Principal.SecurityIdentifier传输它,这样我就可以使用它在.Net C中向Active Directory添加新的访问规则# 如果我使用此格式: System.Security.Principal.IdentityReference newOwner new System.Security.Principal.NTAccount("DUDUG
System.Security.Principal.IdentityReference newOwner new System.Security.Principal.NTAccount("DUDUG");
newOwner.Translate(typeof(System.Security.Principal.SecurityIdentifier);
System.Security.Principal.IdentityReference newOwnernew System.Security.Principal.NTAccount("dudu.test.com","DUDUG")
我可以传输它,但是用户在广告中被翻译成“未知用户”
如果我使用:
System.Security.Principal.IdentityReference newOwner new System.Security.Principal.NTAccount("DUDUG");
newOwner.Translate(typeof(System.Security.Principal.SecurityIdentifier);
System.Security.Principal.IdentityReference newOwnernew System.Security.Principal.NTAccount("dudu.test.com","DUDUG")
或
或
我收到错误消息:
System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated.
你知道怎么做吗
提前谢谢