Solved

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

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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/…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now