Remove domain from request.servervariables("LOGON_USER")

Discussion in 'ASP General' started by Dave Karmens, Apr 21, 2004.

  1. Dave Karmens

    Dave Karmens Guest

    How can I remove the domain name and the \ from
    request.servervariables("LOGON_USER") ?

    Remove everything up to, and include the \ ...
     
    Dave Karmens, Apr 21, 2004
    #1
    1. Advertising

  2. Dave Karmens

    Ray at Guest

    Here's one of many ways:

    aName = Split("\" & Request.ServerVaribles("LOGON_USER"), "\")
    sName = aName(UBound(aName))

    Ray at work


    "Dave Karmens" <> wrote in message
    news:...
    > How can I remove the domain name and the \ from
    > request.servervariables("LOGON_USER") ?
    >
    > Remove everything up to, and include the \ ...
     
    Ray at, Apr 21, 2004
    #2
    1. Advertising

  3. Dave Karmens

    Rob Meade Guest

    "Dave Karmens" wrote ...

    > How can I remove the domain name and the \ from
    > request.servervariables("LOGON_USER") ?
    >
    > Remove everything up to, and include the \ ...


    Perhaps;

    <%
    Dim aName
    Dim strName

    ' create an array by splitting variable by the \
    aName = Split(Request.ServerVariables("LOGON_USER"), "\")

    ' populate variable
    strName = aName(UBound(aName))

    ' clear down
    aName Erase

    ' display to screen
    Response.Write strName
    %>

    Assumptions are that you have actually returned something in that server
    variable - if not it'll error - you'll need to put some additional checks
    around this perhaps.

    Hope this helps,

    Regards

    Rob
     
    Rob Meade, Apr 21, 2004
    #3
  4. Dave Karmens

    Rob Meade Guest

    "Ray at <%=sLocation%> [MVP]" wrote ...

    > Here's one of many ways:
    >
    > aName = Split("\" & Request.ServerVaribles("LOGON_USER"), "\")
    > sName = aName(UBound(aName))


    Damn you beat me! :)

    Rob
     
    Rob Meade, Apr 21, 2004
    #4
  5. Dave Karmens

    Dave Karmens Guest

    thanks guys :)

    Ray at <%=sLocation%> [MVP] wrote:

    > Here's one of many ways:
    >
    > aName = Split("\" & Request.ServerVaribles("LOGON_USER"), "\")
    > sName = aName(UBound(aName))
    >
    > Ray at work
    >
    >
    > "Dave Karmens" <> wrote in message
    > news:...
    >
    >>How can I remove the domain name and the \ from
    >>request.servervariables("LOGON_USER") ?
    >>
    >>Remove everything up to, and include the \ ...

    >
    >
    >
     
    Dave Karmens, Apr 21, 2004
    #5
  6. Dave Karmens

    Roland Hall Guest

    "Rob Meade" wrote in message
    news:lhAhc.318$...
    : ' clear down
    : aName Erase

    Erase aName

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Apr 22, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. T.
    Replies:
    7
    Views:
    15,911
    RiaanBod
    Apr 28, 2011
  2. Amitava Bardhan
    Replies:
    1
    Views:
    2,936
    Marina
    May 17, 2005
  3. =?Utf-8?B?THluZXJz?=
    Replies:
    0
    Views:
    1,409
    =?Utf-8?B?THluZXJz?=
    Dec 5, 2005
  4. Replies:
    1
    Views:
    1,624
    Göran Andersson
    Nov 29, 2008
  5. Charles Evans
    Replies:
    0
    Views:
    415
    Charles Evans
    Sep 10, 2003
Loading...

Share This Page