Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I need to authenticate a lotus notes user from my C# code.
I am using DirectoryEntry to authenticate a user against Active Directory and it works fine, but when I do the same against Domino server I am always getting a valid "Name" field (Even for wrong password).

Can you help?

Thanks!!!
Posted

1 solution

private DirectoryEntry entry;
entry = new DirectoryEntry("LDAP://" + oDomainName + "", oUserName,
oPassword, System.DirectoryServices.AuthenticationTypes.Secure);

private DirectorySearcher ds;
entry = new DirectoryEntry("LDAP://" + oDomainName + "", oUserName,
oPassword, System.DirectoryServices.AuthenticationTypes.Secure);

SQL
Then made a search in active directory against your login credentials, if searchresult returns object of the user it means that user exist in the Active Directory with the submitted credentials.
The source code also contains a method "GetDomains" which returns an ArrayList having all the domains that are present in the network
.

public ArrayList GetDomains()
{
ArrayList arrDomains = new ArrayList();
DirectoryEntry ParentEntry = new DirectoryEntry();
try
{
ParentEntry.Path = "WinNT:";
foreach (DirectoryEntry childEntry in ParentEntry.Children)
{
switch (childEntry.SchemaClassName)
{
case "Domain":
{
arrDomains.Add(childEntry.Name);
break;
}
default:
{
break;
}
}} }
catch (Exception e)
{
}
finally
{
ParentEntry = null;
}
return arrDomains;
}


Try this and let me know if this thing work aur not
 
Share this answer
 
v2
Comments
orenbak 15-Sep-10 6:30am    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
orenbak 15-Sep-10 6:39am    
Thanks for quick answer!
I already use the code above, and it works fine for Active Directory authentication. The problem is that this code doesn't work for Lotus Notes.
When I use this code I get a valid entry.Name even for wrong password

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900