0
錯誤1:發生操作錯誤。UserPrincipal的錯誤Getauthorizationgroups
錯誤2:嘗試檢索授權組時,發生錯誤 (110)。
public static bool CheckGroupMembership(string userID, string groupName, string domain)
{
bool isMember = false;
// Get an error here, so then I use my username/password and it works...
PrincipalContext ADDomain = new PrincipalContext(ContextType.Domain, domain);
UserPrincipal oUserPrincipal = UserPrincipal.FindByIdentity(ADDomain, userID);
PrincipalSearchResult<Principal> oPrincipalSearchResult = oUserPrincipal.GetAuthorizationGroups(); //<-- Error is here:
foreach (Principal oResult in oPrincipalSearchResult)
{
if (oResult.Name.ToLower().Trim() == groupName.ToLower().Trim())
{
isMember = true;
}
}
return isMember;
}
這當我在同一臺機器上調試的所有作品,當我從遠程服務器拉起網頁它只是失敗。