We help IT Professionals succeed at work.
Get Started

User Authentication with Classic ASP

Stefan Motz
Stefan Motz asked
Last Modified: 2015-04-20
Hi Experts,
I'm using the attached code for user authentication.
Users have two different options to log in.
When they log in with their EMP_ID the logon format is someting like USA\U123456, or EUROPE\U 123456, or ASIA\U123456
The EMP_ID part from the logon is 123456. This is what I capture, and it's working fine.
The problem is when they log in with their ALT_ID
In this case the logon format is something like USA\ABC12, or EUROPE\RTX24T, or ASIA\G678PFGH
This is when I can't capture their EMP_ID, LAST_NAME, or FIRST_NAME.
How can the code below be changed to be able to capture their identity with any of their logon options.
Thank you for your help.
set rs = Server.CreateObject("ADODB.recordset")
Dim UserID
UserID = Request.ServerVariables("LOGON_USER")

UserID = Replace(UCase(UserID), "\U", "\")
UserID = Mid(UserID,instr(UserID,"\")+1)

rs.Open "exec sp_Authentication'" & UserID & "'", Conn

do until rs.EOF
EMP_ID = rs("EMP_ID")
ALT_ID = rs("ALT_ID")

Set rs = Nothing

<br />

Open in new window

Watch Question
Web Ninja at large
This problem has been solved!
Unlock 1 Answer and 24 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE