Solved

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

Posted on 2004-08-09
1
445 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Calculating value of records from a column - classic asp 7 80
Hide row when retrieving data from database 6 61
INNER JOIN ? 8 47
Hide cell in a table 2 14
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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