1.Create web service application and add custom service to the project.In my case service name ADAuthentication.asmx .Then add reference to the project(System.DirectoryServices)
2.Create Web Method to authenticate users in the active directory.In my case I'm named web method called ActiveDirectoryAuthentication which gets username and password as parameters.My method will be like this
.
[WebMethod]
public bool ActiveDirectoryAuthentication(string userName, string password)
{
bool IsUser = false;
string domain = "Insert your domain here";
try
{
DirectoryEntry entry = new DirectoryEntry("LDAP://" + domain,
userName, password);
object nativeObject = entry.NativeObject;
IsUser= true;
}
catch (DirectoryServicesCOMException) { }
return IsUser;
}
According to my web method this return boolean value whether this user valid or not.
4.Once we invoke web service by giving username and password.It will provide xml which contain boolean value(true or false)
Thanks....