Solved

Better soloution to get firstname and last name from Request.ServerVariables("AUTH_USER")

Posted on 2004-08-09
1
451 Views
Last Modified: 2012-06-22
Hi , I have the following that takes the firstname and lastname of a user and spits out the email address internally.

I want to use this to "fill in" a text box field.

However the lastname doesnt work for some users..

Ie Lastname "Boyle" comes up ok , but "Robinson" doesnt.....

Cheers!

dim strUser, strNTUser, checkNT, strNTUserInfo, sHour,strLen,strEmail
    strNTUser = Request.ServerVariables("AUTH_USER")
   strNTUser = replace(strNTUser, "\", "/")    
      strUser = Mid(strNTUser,(instr(1,strNTUser,"/")+1),len(strNTUser))
        response.write strUser
     On Error Resume Next
     Set strNTUserInfo = GetObject("winnt://"+strNTUser)
       Err.Clear
       on error goto 0

strUserfirst = Mid(strUser, 1, instr(strUser, " ") - 1)
strUserfirst = lcase(strUserfirst)
strLen=Len(strUserfirst)
strLen=StrLen+1
struserlast = mid(strUser, strLen+1, instr(strUser, strUserfirst) +(strLen-1))
struserlast =  lcase(struserlast)
response.write strUserlast
strUserUp = lcase(left (strUser, 1)) & lcase(mid(strUser, 1))

strEmail= strUserfirst & "." & struserlast & "@domain.com"
if strEmail ="" then strEmail="Enter your email"
0
Comment
Question by:sgriffin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 26

Accepted Solution

by:
Hilaire earned 125 total points
ID: 11754433
try

strUserFirst=lcase(split(strUser & " ", " ")(0))
strUserLast=lcase(split(strUser & " ", " ")(1))

strEmail= strUserfirst & "." & struserlast & "@domain.com"
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

689 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