Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 592
  • Last Modified:

how to parse userid from logon_user

myString = Request.ServerVariables("LOGON_USER")

How do I parse the user id out of mystring? (i.e., I don't need the domain name, just the userid)
0
GessWurker
Asked:
GessWurker
  • 3
  • 3
1 Solution
 
AkhaterCommented:
you mean something like

Dim userID,arrUser,uid

userID = Request.ServerVariables("LOGON_USER")
arrUser = Split (userID,"\")
uid = arrUser(0)
0
 
GessWurkerAuthor Commented:
Something like that, yes, but... should check for the presence of a "\" first?
0
 
AkhaterCommented:
sorry I didn't get what you mean ?
arrUser = Split (userID,"\") is splitting the userID at the "\"

0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
GessWurkerAuthor Commented:
Sorry. Don't know asp. The code won't fail if no "\" is present?
0
 
AkhaterCommented:


if there is no "\" arrUser will be equal to userID
0
 
GessWurkerAuthor Commented:
Great! This seems to work perfectly:

userID = Request.ServerVariables("LOGON_USER")
arrUser = Split (userID,"\")
uid = arrUser(1)
response.write("User name without domain: " & uid)

Thanks! Points to you!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now