Authenticate users using AD and LDAP

  • Thread starter Thread starter Sync Walantaji
  • Start date Start date
S

Sync Walantaji

Hi,
I would like to write a asp.net winform program to authenticate users
on Active Directory.

Can I do this with asp.net if the IIS server is not part of the Active
directory domain?

Is there a working example link that you can point me to?

Thanks
 
I'm confused by the IIS setup.
It says you need to put in a domain account.
Does this means any domain account that can login to the domain will
work as an IIS account?
 
Yep..
Yes so far u have a domain and the users have accts in the domain it will
work!
U just have to pass the LDAP path of ur domain.
Just make sure that in IIS the virtual directory where ur application
resides has the
Anonymous Access clicked or forms Auth won't work.
[its under the directory Security tab ]
Enjoy..
Patrick
 
I'm getting the following errors while submitting the form:

1.Error authenticating. Error authenticating user.
A referral was returned from the server
2.Error authenticating. Error obtaining group names. The specified
domain either does not exist or could not be contacted

What's the correct syntax to replace this?:
String adPath = "LDAP://DC=..,DC=..";
//Path to you LDAP directory server

I tried
String adPath =
"LDAP://domainname.company.com/DC=domainname,DC=company,DC=com";

String adPath =
"LDAP://domainname.company.com/ou=active,ou=company.com";

Basically No clue.
I can see the program is contacting Domain controller and is using
kerberros because tcp ports is active....
I have tried using this code on two different domains. One I created
myself, one from company central AD. Neither works.
I can logon to domain shares without any problem, so I know the
username and password is good on both domain.

Can someone help to teach me to debug this?
 
Hi Sync,
Actually the form Auth on the msdn never worked completely for me
too!But ur LDAP should be like
this :-String adPath =LDAP://code.com.au/DC=code,DC=com,DC=au
'm not quiet sure now bcos i'm out of the office on the road.
What i noticed in the code is that i could never get group Names.
So my advice is comment out the function code that is meant to get the
GROUPS and 'm sure u would authenticate!
If not mail me to (e-mail address removed) and i'd help u sort that out.
Enjoy
Patrick
 
Ok, it's working except the group thing...
Thanks

Hi Sync,
Actually the form Auth on the msdn never worked completely for me
too!But ur LDAP should be like
this :-String adPath =LDAP://code.com.au/DC=code,DC=com,DC=au
'm not quiet sure now bcos i'm out of the office on the road.
What i noticed in the code is that i could never get group Names.
So my advice is comment out the function code that is meant to get the
GROUPS and 'm sure u would authenticate!
If not mail me to (e-mail address removed) and i'd help u sort that out.
Enjoy
Patrick
 
Good its working...
If you are interested in getting the groups let me know!
Enjoy!
Patrick

Sync Walantaji said:
Ok, it's working except the group thing...
Thanks
 
Back
Top