If your company or home network uses the NT Domain Authentication method, you can use an ASP script to format that login to appear any way you want, without the domain name attached.

For this example, we'll use the domain TEST, and the user JOHN_SMITH.

The standard domain login appears like this as a server variable: TEST\JOHN_SMITH . If your domain logins are in this format, and use login formats of FIRST_LAST, or LAST_FIRST as the login name, then the following script should work for you:

userLogin = Request.ServerVariables("REMOTE_USER")
Session("NTLogon") = LCase(Right(userLogon, Len(userLogon) - InStr(1, userLogon, "\")))
userLast = (Right(Session("NTLogon"), Len(Session("NTLogon")) - InStr(1, Session("NTLogon"), "_")))
userFirst = (Left(Session("NTLogon"), InStr(1,Session("NTLogon"), "_")))
userFirst = replace(userFirst,"_","")
userFirst = trim(userFirst)
userLast = replace(userLast,"_","")
userLast = trim(userLast)

upperFirstF = UCase(Left(userFirst, 1)
lowerRestF = right(userFirst, len(userFirst) -1)

upperFirstL = UCase(Left(userLast, 1)
lowerRestL = right(userLast, len(userLast) -1)

fullNorm = upperFirstF&lowerRestF&" "&upperFirstL&lowerRestL

fullRev = upperFirstL&lowerRestL&", "&upperFirstF&lowerRestF

The resulting variables (fullNorm and fullRev), when written out to the page, will appear like this:

fullNorm is: John Smith
fullRev is:  Smith, John

Of course, there are other ways of performing the same task, but I've found that this works beautifully for any domain, regardless of the length of the login name or the domain name.

Log in or register to write something here or to contact authors.