create and use DLL

Posted on 2006-05-29
Last Modified: 2010-04-30
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
Question by:ellandrd
    LVL 92

    Accepted Solution

    Hi ellandrd,

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


    LVL 16

    Author Comment

    but how do i run it so i can display the username in a webpage?
    LVL 16

    Author Comment

    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...
    LVL 10

    Expert Comment

    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.
    LVL 16

    Author Comment

    >>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...
    LVL 16

    Author Comment

    how do i use this DLL already created? you never said how i use it?

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Introduction While answering a recent question ( in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now