Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LDAP versus SystemInformation.UserName

Status
Not open for further replies.

lucyv

Programmer
Mar 11, 2002
152
US
I am developing a computer system that requires the user to log in (user name and password is stored in a database table). However, instead of having to enter their username and password, my users would the system to work with Active Directory. This will prevent them from having to remember their password.

I've been thinking about this for a while. Instead of having to program my system to interact with Active Directory (something I don't know how to do yet), wouldn't it be just as good to get the user's computer login name (SystemInformation.UserName) and check to see if this ID is in my database table? Every user has their own unique computer login id, and if they are able to log into the computer then they should be able to login into my system as well.

Does anybody have any thoughts regarding this? Any input would be much appreciated.


 
If all you need is the user name, then just use the environment.UserName. LDAP is great if you need more information, but would be a bit overkill for just finding out the UserID of the logged on user.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Rick, I completely agree with you. Does anyone else have any comments on this?

-lucyv
 
Additionally, I don't think there would be an easy way to get the user's ID from LDAP with out first knowing abunch about the user. You can query LDAP similar to a database. But with out knowing the User ID you would have to do the look up on other information which would require more work on the user's part I would imagine.

For Example, here is a function I use to get the User's full name as it is stored in LDAP:
Code:
    Public Shared Function UserNameLong(ByVal UserID As String)
      Dim FullName As String
      Try
        Dim ADEntry As New System.DirectoryServices.DirectoryEntry("WinNT://DomainName/" & UserID.Trim)
        FullName = ADEntry.Properties("FullName").Value
      Catch exc As Exception
        FullName = ""
      End Try
      Return FullName
    End Function

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Rick, those were my thoughts exactly (I didn't post this in my original message because I didn't want to make it too long). From what I understand about LDAP, I would need additional information on connecting to the LDAP (probably some type of user id and password). And because the general users will more than likely not know this information I would probably have to hard-code it into the system (which is very bad).

I'm starting to like the SystemInformation.UserName option a lot more.

-lucyv
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top