I have a page where I need to display the user's full name. The users are authenticated by Windows when accessing the site.
I have accomplished this, but I'm sure there must be an easier way. Is it possible to display the user's "Display Name" as it is entered in Active Directory?
My quick solution, after not being able to find a better way on Google, was to create a new table in the database and call it "users". I made two columns. 1 called "LogonName" where I entered the domain logons for all of the users who need to access the site right now. The other column is called "DisplayName" in this column I entered the users' full names.
I threw in this SQL statement:
strSQL = "SELECT * FROM users WHERE LogonName = '"&request.serverVariables("LOGON_USER")&"';" |
And where I needed to display the name I placed this code:
<%Response.Write (rsUser("DisplayName"))%> |
This works for now, but in the future more users will need to access the site, so is there a way that I can simply pull the Display Name from Active Directory?
Thanks in advance!