AD forms authentication

H

hari

I am trying to authenticate to ad using this how-to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/secnetlpMSDN.asp

The server is W2k3 and auth hangs here:
****************************************************************************
****
string adPath = @"mypath";
LdapAuthentication adAuth = new LdapAuthentication(adPath);
lblError.Text = "I made it this far!";
if(true == adAuth.IsAuthenticated(txtDomainName.Text, txtUserName.Text,
txtPassword.Text))
{
// Retrieve the user's groups
lblError.Text = " I got the groups";
string groups = adAuth.GetGroups();
// Create the authetication ticket
FormsAuthenticationTicket authTicket = new
FormsAuthenticationTicket(1, txtUserName.Text, DateTime.Now,
DateTime.Now.AddMinutes(60), false, groups);
// Now encrypt the ticket.
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
// Create a cookie and add the encrypted ticket to the cookie as data.
HttpCookie authCookie = new
HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
// Add the cookie to the outgoing cookies collection.
Response.Cookies.Add(authCookie);
lblError.Text = "Success!";
// Redirect the user to the originally requested page
Response.Redirect( FormsAuthentication.GetRedirectUrl(txtUserName.Text,
false));
}
else
{
lblError.Text = "Authentication failed, check username and password.";

}
}
catch(Exception ex)
{
lblError.Text = "Error authenticating. " + ex.Message;
}

********************************************************
The error is this:
Error authenticating. Error obtaining group names. The specified domain
either does not exist or could not be contacted

I know that the server is being contacted and that the username is being
queried, because I can move the username a recieve a "user not found error".
I cannot figure out why the program is unable to access the groups. I
suspect the permissions in W2k3 are not letting the program access the
groups, but I am lost as to how to resolve this.

MAny Thanks
Harry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top