사용자가 Active Directory에 있는지 확인하고 사용자 계정이 사용되는지 확인하는 웹 서비스를 작성하고 있습니다. 일단 확인하면, 나는 그들의 사용자 계정을 검증한다. 성공적으로 사용자 이름과 비밀번호를 입력하면 인증하는 사람의 GUID
또는 NativeGuid
번을 받고 싶습니다. GUID
또는 NativeGUID
을 사용하여 SQL Server 데이터베이스 내에서 관계를 구축하고 싶습니다. 내가 다른 사용자의 GUID
또는 NativeGUID
그것은 나에게 같은 ID
을 반환하는 것 하나 하나 시간을 얻을 때Active Directory에서 GUID 또는 기본 GUID 가져 오기
public string isAuthenticated (string serverName, string userName, string pwd)
{
string _serverName, _userName, _pwd;
_serverName = serverName;
_userName = userName;
_pwd = pwd;
string message;
if (DoesUserExist (_userName) == true)
{
if (isActive(userName) == true)
{
try
{
DirectoryEntry entry = new DirectoryEntry(_serverName, _userName, _pwd);
object nativeObject = entry.NativeObject;
//issue is here
string GUID = entry.Guid.ToString();
string GUIDID = entry.NativeGuid;
//end of issue
message = "Successfully authenticated";
}
catch(DirectoryServicesCOMException ex)
{
message = ex.Message;
}
}
else
{
message = "Account is disabled";
}
}
else
{
message = "There's an issue with your account.";
}
return message;
}
:
는 여기에 내가 데려 갈거야 접근이다.
Active Directory의 다른 개체에 대해 UNIQUE ID
을 얻으려면 다른 방법이 있습니까?
감사
예이 기능이 작동합니다. 거의 동일한 코드를 붙여 넣으려고했습니다. UPV – MajkeloDev
@marc_s 감사합니다. 이것은 내가 필요한 것입니다. – smr5