Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Authenticating using Windows Authentication

I have used this function on my logon on page in Visual Studio 2005. I enter the correct user name and password that I know is in Active Directory, but I still get an unsuccesful logon. When I break through my code I can see my usernamen and password in plain text so I know that i have accessed Active Directory. Is there something else i have to do to use the log on control in VS 2005. Please provide any assitance as clear as possible. I am very new to .net and need to accomplish this task.

what I am trying ot accomplish is to have the users log on using their windows account. We do want them to have to enter their user name and password. Do I need the Iuser account to have rights to active directory? Any assistance would be greatly appreciated.

Public Function IsAuthenticated(ByVal domain As String, ByVal username As String, ByVal pwd As String) As Boolean Dim domainAndUsername As String = "" domainAndUsername = domain & "\" & username Dim entry As New DirectoryEntry("LDAP://DC=ABC,DC=local", domainAndUsername, pwd) Dim obj As Object Try obj = entry.NativeObject Dim search As New DirectorySearcher(entry) Dim result As SearchResult search.Filter = "(SAMAccountName=" + username + ")" search.PropertiesToLoad.Add("cn") result = search.FindOne() If result Is Nothing Then Return False End If Catch ex As Exception Return False End Try Return True End Function
[1577 byte] By [HeatherMack] at [2007-11-11 10:15:27]
# 1 Re: Authenticating using Windows Authentication
http://msdn2.microsoft.com/en-us/library/ms998360.aspx
Phil Weber at 2007-11-11 23:12:03 >