Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > AD forms authentication

Reply
Thread Tools

AD forms authentication

 
 
hari
Guest
Posts: n/a
 
      08-20-2004
I am trying to authenticate to ad using this how-to
http://msdn.microsoft.com/library/de...cnetlpMSDN.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.Tex t,
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


 
Reply With Quote
 
 
 
 
Patrick.O.Ige
Guest
Posts: n/a
 
      08-28-2004
Check your LDAP path or get it from you Network Adimin.
Cheers


"hari" <mackeyha2athotmaildotcom> wrote in message
news:(E-Mail Removed)...
> I am trying to authenticate to ad using this how-to
>

http://msdn.microsoft.com/library/de...us/dnnetsec/ht
ml/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.Tex t,
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best practices for using forms authentication and security in a hosted env (was: Re: Using a Forms authentication in a shared hosting environment) JEFF ASP .Net 1 11-12-2007 07:00 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Forms authentication - Multiple login forms based on directory acc Keltex ASP .Net Security 1 01-24-2006 03:06 PM
Forms Authentication question: How to have some pages open and some requiring forms authentication Eric ASP .Net 2 02-13-2004 02:14 PM
Forms Authentication, external authentication server, & rerouting to orig. req. URL Andrew Connell ASP .Net 1 10-21-2003 05:41 PM



Advertisments