Solved

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

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Html Table looping 4 40
ASP Classic - Read XML File inner content 10 68
Getting robots.txt Error 9 53
Get Pop-Up Or Div Info Box From JQuery DataTable Cell in ASP 7 31
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

742 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