UserPrincipal.IsMemberOf(GroupPrincipal)跨域ASP.Net

时间:2017-05-05 13:18:42

标签: c# asp.net principalcontext groupprincipal

我希望修改一个站点以跨域验证,但是当运行并从另一个域以用户身份登录时,它会给出以下错误。您能否告知需要将哪些安全设置应用于ASP.Net应用程序池以启用此功能?

The user name or password is incorrect 

[DirectoryServicesCOMException (0x8007052e): The user name or password is incorrect.
]
   System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +596521
   System.DirectoryServices.DirectoryEntry.Bind() +44
   System.DirectoryServices.DirectoryEntry.RefreshCache(String[] propertyNames) +77
   System.DirectoryServices.AccountManagement.ADStoreCtx.LoadDomainInfo() +872
   System.DirectoryServices.AccountManagement.ADStoreCtx.get_UserSuppliedServerName() +129
   System.DirectoryServices.AccountManagement.ADStoreCtx.IsMemberOfInStore(GroupPrincipal g, Principal p) +976

[AuthenticationException: The user name or password is incorrect.
]
   System.DirectoryServices.AccountManagement.ADStoreCtx.IsMemberOfInStore(GroupPrincipal g, Principal p) +2103

正在运行的代码 - 只显示与查询相关的对象

string Domain = userName.Split('\\')[0];

var pc = new PrincipalContext(ContextType.Domain, Domain);
var gpGeneral = GroupPrincipal.FindByIdentity(pc, "GroupName");

up.IsMemberOf(gpGeneral)

0 个答案:

没有答案