Results 1 to 3 of 3

Thread: Get NT login ID

  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Get NT login ID

    I'm using IIS 5.0 on my Windows 2000 Professional notebook; new to the world of scripting, but comfortable with VBA and general programming constructs.

    I'm able to write data from a form in a HTML page into an Access table with no trouble, and am able to stamp the records with Date/Time stamp. I'd also like to grab the NT user ID of the user who inputted data, but am unsure how. Not only would this be a good way to audit the input of data, but also allow a dynamic filter when the users want to query the db; I can only show them records they inputted. Anybody have a code snippet or a resource they can point me to? Thanks in advance!

    Regards,
    <font face="Comic Sans MS"><font color=blue>~Shane</font color=blue></font face=comic>

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get NT login ID

    There's an article on this at Returning the Username
    <A target="_blank" HREF=http://www.mvps.org/access/api/api0066.htm>Return the Full Name of the logged in user</A>

    Hope that helps!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  3. #3
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Get NT login ID

    I was actually looking for a way to get the equivalent of an API call to get the login name of the user accessing my ASP page; I should have been more specific in my original post, and it was only after spending a week with the nice folks at AppDev that I was able to figure it out. <img src=/S/joy.gif border=0 alt=joy width=23 height=23>

    If you're developing on an internal, NT based web, and the virtual directory of your ASP page is set to not allow anonymous access but to use integrated Windows authentication, you can use Request.ServerVariables("AUTH_USER") to get the login name. The function I'm using is below; let me know if anyone has a more elegant way to go about it.
    '''''''''''''''''''''
    <%@ Language=VBScript %>
    <%Option Explicit %>
    <%
    dim intUserID
    dim strID

    Function GetUser()
    intUserID = Split(Request.ServerVariables("AUTH_USER"),"")
    strID = intUserID(UBound(intUserID))
    GetUser = strID
    End Function
    %>


    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    Here is the person logged into the network:

    <%
    Response.Write("" & getuser() & "")
    %>



    The above derived from the below - Request.ServerVariables("AUTH_USER"):

    <%Response.Write("" & Request.ServerVariables("AUTH_USER")&"")%>
    </p>
    </body>
    </html>
    <font face="Comic Sans MS"><font color=blue>~Shane</font color=blue></font face=comic>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •