Ask a Question related to ASP.NET Security, Design and Development.
-
hari #1
AD forms authentication
I am trying to authenticate to ad using this how-to
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/secnetlpMSDN.asp[/url]
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
hari Guest
-
Accessing htm files without authentication (forms authentication)
I have application with forms authentication. All works fine. When user opens .aspx file gets login form, login and then get the .aspx page. But... -
ASP.Net Forms authentication with basic authentication popup
Relatively new to ASP.Net but have a strange problem. My site uses forms authentication for a large administration section however after the user... -
Forms authentication then redirection to a secure web with NT authentication?
Hi, I want to allow access to particular secured intranet web sites. These intranet are stored in sharepoint (2003 version) Actually I've... -
Authentication ticket, cookieless, forms authentication?
Hi. I want to use Forms Authentication, cookieless. The issue is setting the Authentication Ticket without using cookies (!) That is, the... -
Forms authentication with Windows authentication
Hi, I have an ASP.NET web site that uses IIS Basic Authentication and accesses an OLAP Server at various stages. The OLAP Server authentication... -
Patrick.O.Ige #2
Re: AD forms authentication
Check your LDAP path or get it from you Network Adimin.
Cheers
"hari" <mackeyha2athotmaildotcom> wrote in message
news:uefMfmvhEHA.396@TK2MSFTNGP12.phx.gbl...[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/ht[/url]> I am trying to authenticate to ad using this how-to
>
ml/secnetlpMSDN.asp************************************************** **************************>
> The server is W2k3 and auth hangs here:
>txtUserName.Text,> ****
> string adPath = @"mypath";
> LdapAuthentication adAuth = new LdapAuthentication(adPath);
> lblError.Text = "I made it this far!";
> if(true == adAuth.IsAuthenticated(txtDomainName.Text,data.> 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 asFormsAuthentication.GetRedirectUrl(txtUserName.Tex t,> 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(password.";> false));
> }
> else
> {
> lblError.Text = "Authentication failed, check username anderror".>
> }
> }
> 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> 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
>
>
Patrick.O.Ige Guest



Reply With Quote

