UserPrincipal.IsMemberOf(GroupPrincipal) across domains ASP.Net

464 Views Asked by At

I am looking to amend a site to validate across domain but it gives the error below when run and login as the user from the other domain. Can you advise what security setting needs to be applied to the ASP.Net application pool to enable this?

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

Code that is running - just showing objects relevant to query

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

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

up.IsMemberOf(gpGeneral)
0

There are 0 best solutions below