Hi Team,
It is really urgent I want to implement LDAP validation in my web application
As we are login with citirx VM and enter the username & Password then access intanet application in this application we need to valdiate the user through LDAP and do not want to ask user credential without asking credential checked in LDAP if user is exist in LDAP so he is able to access and by pass the user to Home page else display message user not authorized ..
Please advice how can be implement..Currently I have use below piece of code this code validate in my local but when i deoply the code in IIS it is not working and throwing error in IIS level below sttings done configuration
Authentication:
Windows Authentication: Enabled
Asp.net Impersonation:Enabled
Anonymous Authentication: Disabled
----------------------------------
PLEASE ADVICE HOW CAN BE IMPLELMENT IT IS REALLY URGENT WE NEED TO MET DEADLINE
-----------------------------------------
IUSRNT AUTHORITY
Hello .
You are not authenticated using .
--------------------------------------------
COde
-----------------------------------------------------
bool validation;
try
{
LdapConnection lcon = new LdapConnection(new LdapDirectoryIdentifier((string)null, false, false));
NetworkCredential nc = new NetworkCredential(Environment.UserName, "welcome6citi@", Environment.UserDomainName);
Response.Write(nc.UserName.ToString());
Response.Write(nc.Domain.ToString());
lcon.Credential = nc;
lcon.AuthType = AuthType.Negotiate;
lcon.Bind(nc);
validation = true;
}
catch (LdapException)
{
validation = false;
}
if (validation)
{
Response.Redirect("Home.aspx");
}
else
{
lblName.Text = "Hello " + Context.User.Identity.Name + ".";
lblAuthType.Text = "You are not authenticated using " + Context.User.Identity.AuthenticationType + ".";
}