B
Brian McCullough
Hello,
I am trying to query ADAM using the ActiveDirectoryMembershipProvider in my
ASP.NET 2.0 application, but have been unsuccessful. I have followed the
steps in these blog posts, but still am not able to query ADAM. Every time
I make a call to login, using the Membership.ValidateUser method, I keep
getting a false value. I have tried many different variations of the
username including "localhost\myuseraccount", "myuseraccount@localhost" ,
and just "myuseraccount", but none seem to work.
http://erlend.oftedal.no/blog/?blogid=6
http://blogs.msdn.com/donovanf/arch...bershipprovider-for-forms-authentication.aspx
I tried to see if I could just get a list of users using the
Membership.GetAllUsers() method, but this is returning 0 user accounts
(although I have 2 setup in ADAM).
I took another step back and just tried using the classes in the
System.DirectoryServices namespace to try to enumerate the objects in ADAM.
Again I was unsuccessful. Because I re-read the articles explaining how to
do this several times, and made sure my code was a match, I tried to backup
yet again, and put the code in a WinForms application. IT WORKED! So my
question is, why does the following code work in a WinForms application, but
not an ASP.NET application????? (my guess is something to do with Code
Access Security):
int portNumber = 389; // put the correct port number here.
String serverName = "localhost"; // put the correct servername here.
String partitionDir = "OU=Users,O=TestDirectory"; //put the correct
partition distinguished name.
DirectoryEntry ent = new
DirectoryEntry("LDAP://" + serverName + ":" + portNumber.ToString() + "/" +
partitionDir);
foreach (DirectoryEntry child in ent.Children)
{
Console.WriteLine(child.Name);
}
I am trying to query ADAM using the ActiveDirectoryMembershipProvider in my
ASP.NET 2.0 application, but have been unsuccessful. I have followed the
steps in these blog posts, but still am not able to query ADAM. Every time
I make a call to login, using the Membership.ValidateUser method, I keep
getting a false value. I have tried many different variations of the
username including "localhost\myuseraccount", "myuseraccount@localhost" ,
and just "myuseraccount", but none seem to work.
http://erlend.oftedal.no/blog/?blogid=6
http://blogs.msdn.com/donovanf/arch...bershipprovider-for-forms-authentication.aspx
I tried to see if I could just get a list of users using the
Membership.GetAllUsers() method, but this is returning 0 user accounts
(although I have 2 setup in ADAM).
I took another step back and just tried using the classes in the
System.DirectoryServices namespace to try to enumerate the objects in ADAM.
Again I was unsuccessful. Because I re-read the articles explaining how to
do this several times, and made sure my code was a match, I tried to backup
yet again, and put the code in a WinForms application. IT WORKED! So my
question is, why does the following code work in a WinForms application, but
not an ASP.NET application????? (my guess is something to do with Code
Access Security):
int portNumber = 389; // put the correct port number here.
String serverName = "localhost"; // put the correct servername here.
String partitionDir = "OU=Users,O=TestDirectory"; //put the correct
partition distinguished name.
DirectoryEntry ent = new
DirectoryEntry("LDAP://" + serverName + ":" + portNumber.ToString() + "/" +
partitionDir);
foreach (DirectoryEntry child in ent.Children)
{
Console.WriteLine(child.Name);
}