Last post May 08, 2008 05:15 PM by johram
May 08, 2008 02:28 PM|Skip_Frog|LINK
I am using the below to retrieve the user name from log in credentials. All works good BUT I have to supply a valid user and password for it to work. How do I do this without having to supply a hardcoded user name and password? Thanks
Function GetUserName(ByVal userN
As String) As String
Dim ADEntry As New System.DirectoryServices.DirectoryEntry("WinNT://" & userN)
ADEntry.Username = "xxxxx" 'This is the problem
ADEntry.Password = "xxxxx"
For Each strkey As String In ADEntry.Properties.PropertyNames
Dim strstuff As String = ADEntry.Properties(strkey).Value.ToString
Return "Employee Id not found"
May 08, 2008 05:15 PM|johram|LINK
Please read Ryan Dunn's excellent post "Common System.DirectoryServices Issues and Solutions" in which he explains the different method available for doing exactly what you want :)