Everything2
Near Matches
Ignore Exact
Full Text
Everything2

How to reformat a standard NT Domain login using ASP

created by toastido

(idea) by toastido (1.5 y) (print)   ?   (I like it!) Wed Oct 03 2001 at 0:08:14

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.


printable version
chaos

How to get people to clean up their core dumps Disable ACPI in Windows 2000 Active Server Pages COM
Fahrenheit Reformatting a hard drive E2 Quest: Writeup Redemption DeLorean
NetInfo domain task ASP
variable Script
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Little presents from the Node Fairy:
We all love movies and books about us owning ourselves
Prairie Fires
1000 Hours Deluxe American Superwar Gold!
World War IV
Traci Lords
Her name was Natalie
Evaline Turns the Worm
Nautilus
Fact checking
monster truck
James Stockdale
Periodic Table of the Elements
This life is a placement test for the next
New Writeups
fallensparks
George's Marvellous Medicine(thing)
Ctrl Y
cognitive dissonance(fiction)
SharQ
Gone Baby Gone(review)
halfWit
If I could, I'd title this "Freedom"(thing)
Roninspoon
Airline Hero(thing)
Ktistec
Why Women Are Always Cold(person)
doctor wilson
Drug policy reform(thing)
tejasa
Easy Raspberry Cheesecake(recipe)
Joysim
Drug policy reform(idea)
aneurin
Tyburn(place)
niruena
Boiling to death(idea)
artman2003
summer(thing)
doctor wilson
The Silver City and the Silent Sea(log)
Dreamvirus
The Silver City and the Silent Sea(poetry)
Aerobe
A nihilist's soulmate(poetry)
This affordable entertainment brought to you by The Everything Development Company