That gave me a path that didn't work either. It said
DC=chestnut,DC=net. That exact path did not work (of course with LDAP
added). It kept telling me that the server could not be found. Now if I
input this code:
Protected Sub LoginBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim adPath As String =
"LDAP://chestnut.net/CN=SR-Network_Team,OU=SR,DC=chestnut,DC=net" 'Path
to your LDAP directory server
Dim adAuth As FormsAuth.LdapAuthentication = New FormsAuth.LdapAuthentication(adPath)
Try
If
(True = adAuth.IsAuthenticated(DomainBx.Text, UserNamBx.Text,
PassBx.Text)) Then
Dim groups As String = adAuth.GetGroups()
'Create the ticket, and add the groups.
Dim isCookiePersistent As Boolean = chkPersist.Checked
Dim authTicket As FormsAuthenticationTicket = New
FormsAuthenticationTicket(1, _
UserNamBx.Text, DateTime.Now, DateTime.Now.AddMinutes(60),
isCookiePersistent, groups)
'Encrypt the ticket.
Dim encryptedTicket As String = FormsAuthentication.Encrypt(authTicket)
'Create a cookie, and then add the encrypted ticket to the cookie as
data.
Dim authCookie As HttpCookie = New
HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)
If (isCookiePersistent = True) Then
authCookie.Expires = authTicket.Expiration
End If
'Add the cookie to the outgoing cookies collection.
Response.Cookies.Add(authCookie)
'You can redirect now.
Response.Redirect(FormsAuthentication.GetRedirectUrl(UserNamBx.Text,
False))
Else
errorLabel.Text = "Authentication did not succeed. Check user name and
password."
End If
Catch ex As Exception
errorLabel.Text = "Error authenticating. " & ex.Message
End Try
End Sub
I am getting my errorLabel text "Authenication did not succeed. Check user name and password."
Now I am assuming that my connectivity is not an issue now. The user
credentials are correct, the domainbx.text=chestnut.net is correct. I
am left to think that it is dealing with the cookies creation. Any
suggestions?