Print Page | Close Window

Display Logged on User's Name

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=28430
Printed Date: 28 March 2026 at 5:29pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Display Logged on User's Name
Posted By: kennywhite
Subject: Display Logged on User's Name
Date Posted: 16 March 2010 at 4:35pm
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!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net