Hi All,
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
Next
Try
Return ADEntry.Properties("FullName").Value
Catch
Return "Employee Id not found"
End Try
End Function