public bool IsAuthenticatedUser(string srvr, string usr, string password) { bool authenticated = false; try { DirectoryEntry entry = new DirectoryEntry(srvr, usr, password); object nativeObject = entry.NativeObject; Object obj = entry.NativeObject; authenticated = true; } catch { throw new HttpResponseException(HttpStatusCode.Unauthorized); } return authenticated; } // POST: api/Login public void Post([FromBody]string username, [FromBody]string password) { if (IsAuthenticatedUser("LDAP string", username, password)) { Redirect("Index"); } else { throw new HttpResponseException(HttpStatusCode.Unauthorized); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)