Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void btnLogin_Click(object sender, EventArgs e)
- {
- string Server = "10.0.103.19:389";
- string ruta = "LDAP://" + Server + "/CN=Users,DC=finuniversal,DC=Local";
- DirectoryEntry raiz = new DirectoryEntry(ruta);
- raiz.Path = ruta;
- raiz.AuthenticationType = AuthenticationTypes.Secure;
- raiz.Username = txtUsuario.Text;
- raiz.Password = txtContrasena.Text;
- string filtro = "sAMAccountName";
- string strSearch = filtro + "=" + txtUsuario.Text;
- DirectorySearcher dsSystem = new DirectorySearcher(raiz, strSearch);
- dsSystem.SearchScope = SearchScope.Subtree;
- try
- {
- Session["usuario"] = txtUsuario.Text;
- SearchResult srSystem = dsSystem.FindOne();
- Response.Redirect(Page.ResolveClientUrl("Panel.aspx"));
- }
- catch (Exception error)
- {
- ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Verifique los Datos Correctos')", true);
- /* Response.Write(error.Message); */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement