I work on the login page and the logic is similar to →
try { DirectoryEntry LDAPLogin = new DirectoryEntry(ConfigurationSettings.AppSettings ["LDAPPath"].ToString(), Usuario, Txt_Contrasenia.Text.ToString()); if (LDAPLogin.NativeGuid != LDAPLogin.Name) ValidarGrupo(); } catch (Exception exc) { Label_Info.Text = "Sus credenciales no son validas: " + Usuario.ToString() + " " + exc.Message; }
If the user enters the credentials of rights, I call the ValidarGrupo method, which implements a search in AD for a group of users
I would like to replace the username and password with UseDefaultCredentials to avoid the user entering the username and password, and the login credentials of the user who is the login on the machine are used.
source share