?
Solved

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

Posted on 2004-08-09
1
Medium Priority
?
454 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 500 total points
ID: 11754433
try

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

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

752 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