in config file ..
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="10"/>
</authentication>
in code behind
public ValidateUser(string user, string pass)
{
bool validation;
try
{
LdapConnection ldc = new LdapConnection(new LdapDirectoryIdentifier((string)null, false, false));
NetworkCredential ncon = new NetworkCredential(user, pass, "DOMAINNAME");
ldc.Credential = ncon;
ldc.AuthType = AuthType.Negotiate;
ldc.Bind(ncon);
validation = true;
}
catch (LdapException)
{
validation = false;
}
return validation;
}
No comments:
Post a Comment