An error occurs when a certain user inputs the wrong credentials. Please advise on my concern below and thank you. See below:
0090308: LdapErr: DSID-0C09030B,
comment: AcceptSecurityContext error
Data 525, v893
HEX: 0×525 – user not found
DEC: 1317 – ERROR_NO_SUCH_USER (The specified account does not exist.)
+ System
– EventData
SupportInfo1 1
SupportInfo2 5012
ProcessingMode 0
ProcessingTimelnMilliseconds 1015
Errorcode 49
ErrorDescription Invalid Credentials
DCNam.
Issues with Active Directory LDAP Bind
Use below code to connect to AD of different domain and fetch details of the
user in the other provided a Trust is established.
string primarylogon = box1.Text.ToString().Trim();
//box1.Text = Samaccount Name (LANID)
DirectoryEntry oroot = new DirectoryEntry("LDAP://Domainname");
DirectorySearcher search = new DirectorySearcher(oroot);
search.Filter = String.Format("(SAMAccountName={0})", primarylogon);
search.PropertiesToLoad.Add("SAMAccountName");
search.PropertiesToLoad.Add("givenName");
result = search.FindOne();
if (result == null)
{
lbl1.Text = "No such LAN ID found!Please re-enter the LAN ID";
}else
{
lbl1.Text = "";
string fname;
try
{
fname = result.Properties["givenName"][0].ToString();
}
catch
{
fname = "";
}
}