create and use DLL

how would i create and new my own DLL to retrieve and display the username of the user logged into a Win NT machine?

p.s i have never done this before
LVL 16
Who is Participating?
Patrick MatthewsConnect With a Mentor Commented:
Hi ellandrd,

There is no need to make a DLL for this, as an API function already exists:


ellandrdAuthor Commented:
but how do i run it so i can display the username in a webpage?
ellandrdAuthor Commented:
what is mean by new module?  how cani run this? what type of extension does it have?

sorry i have never done anything like this before so it is all new to me...
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

If you're website is using IIS with Integrated Windows Authentication then you can simply use:

  Dim UserName

  UserName = Request.ServerVariables("LOGON_USER")

  if InStr(UserName,"\")>0 then
    UserName = Right(UserName,Len(UserName) - InStr(UserName,"\"))
  end if


to get the NT Username, although you need to make sure "anonymous access" is unchecked. To check this right-click the website in IIS, select "properties", select the "Directory Security" tab and in the "Anonymous Access and Authentication Control" box at the top click the "Edit" button.
ellandrdAuthor Commented:
>>to get the NT Username, although you need to make sure "anonymous access" is unchecked.

this be be done - we need this checked for other reasons so using auth_user wont work...
ellandrdAuthor Commented:
how do i use this DLL already created? you never said how i use it?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.