Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:40 PM
Ryan Ritten
Guest
 
Posts: n/a
Default ASP grabbing windows username

Anyone know how it is possible for windows to get the name of the user
logged in?

I know if you do :

Request.Servervariables ("AUTH_USER")

it displays the username of the person logged in, but is there a way
to get the "Full name" of that user in the active directory?

Ie, if they log in with the username jsmith, I from that I know there
full name is John Smith.

Any ideas?

TIA

Ryan R
  #2  
Old July 19th, 2005, 01:41 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: ASP grabbing windows username

Yes, you use ADSI.
http://groups.google.com/groups?q=as...=Google+Search

However, the ASP page must execute in the context of a user who has the
authority to query active directory.

--
http://www.aspfaq.com/
(Reverse address to reply.)




"Ryan Ritten" <sparticusREMOVE@thesparticusarena.com> wrote in message
news:f4d27a4f.0406070939.7d13cc12@posting.google.c om...[color=blue]
> Anyone know how it is possible for windows to get the name of the user
> logged in?
>
> I know if you do :
>
> Request.Servervariables ("AUTH_USER")
>
> it displays the username of the person logged in, but is there a way
> to get the "Full name" of that user in the active directory?
>
> Ie, if they log in with the username jsmith, I from that I know there
> full name is John Smith.
>
> Any ideas?
>
> TIA
>
> Ryan R[/color]


  #3  
Old July 19th, 2005, 01:41 PM
Egbert Nierop \(MVP for IIS\)
Guest
 
Posts: n/a
Default Re: ASP grabbing windows username

"Ryan Ritten" <sparticusREMOVE@thesparticusarena.com> wrote in message
news:f4d27a4f.0406070939.7d13cc12@posting.google.c om...[color=blue]
> Anyone know how it is possible for windows to get the name of the user
> logged in?
>
> I know if you do :
>
> Request.Servervariables ("AUTH_USER")[/color]


write a VB6 (or use some other language) and wrap the Secur32.dll exported
API
GetUserNameEx(NameDisplay, .. )

and it will show you the current user (namedisplay is a win32 constant which
equals 3)
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

  #4  
Old July 19th, 2005, 01:41 PM
Egbert Nierop \(MVP for IIS\)
Guest
 
Posts: n/a
Default Re: ASP grabbing windows username

enum Extended_Name_Format
NameDisplay = 3,
NameCanonical=7,
NameFullyQualifiedDN=1
etc...
end enum

Private Declare Function GetUserNameEx Lib "Secur32.DLL" Alias
"GetUserNameExW" (ByVal fmt As EXTENDED_NAME_FORMAT, _
ByVal lpNameBuffer As Long, ByRef nSize As Long) As Long

Public Function GetUserName(byval fmt as Extened_name_Format) As String
Dim sBuf As String
Dim UsrLength As Long
Dim lResult As Long
UsrLength = 100
sBuf = Space$(100)
Dim lErr As Long
lResult = GetUserNameEx(fmt , sBuf, UsrLength)
If lResult = 0 Then
lErr = GetLastError
End If
GetUserName = Left(sBuf, UsrLength)
End Function

--

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles