Web Hosting Talk







View Full Version : ASP Question


fatbargains
08-05-2002, 01:01 PM
Could someone write a quick asp script that takes the username and password from the current log in user? I'm a newbie an very clueless. Thanks.

devon
08-05-2002, 01:07 PM
Which current logged in user are you talking about? The user that is logged into Windows, or the user that is logged into your site through another ASP page?

fatbargains
08-05-2002, 01:28 PM
I want to get the user that is accessing the asp page login and password (the login when he signs on to his machine).

The reason i'm taking his windows logon username and password so i can pass those variables to another application.

devon
08-05-2002, 01:31 PM
OK, then that would probably be stored in a session variable by the login page, such as
Session("uid") and Session("pw")

You only need to access those session variables to get the username and password.

If you aren't storing the username and password with the login page, then you should change it to do that so you can access this info on other pages.

Hope this helps.

Adam_S
08-05-2002, 02:49 PM
I think you are looking for:

Request.Servervariables("AUTH_USER")

and

Request.Servervariables("AUTH_PASSWORD")
I think its this one. It will only work with basic authentication though.

fatbargains
08-06-2002, 02:55 PM
I use Request.Servervariables("AUTH_USER")

and why it doesn't give me anything? is there something that I have to set to in the IIS webserver?

The ALL_HTTP gives me the header info though. Your help is appreciated.

Lagniappe-labgeek
08-06-2002, 05:37 PM
>(the login when he signs on to his machine).

Looks like he means the Windows itself name/password (or NT domain or Netware, etc.).

I don't think you can do this... For one thing it would be a HUGE security hole. Image getting this info from someone who was on a dedicated line of some type, dsl w/static ip, DS-x, OC-x network, etc. If file sharing was on, you have access to everything on the machine he did. And it's not like file sharing or windows needs any more security holes than they've got already.

fatbargains
08-06-2002, 06:17 PM
Sorrie for the confusing.. Is it possible to get just the Username? I dont want the password. Thanks.

Qgyen
08-06-2002, 09:09 PM
Is this for an internet site or like a company's intranet? If it is just an intranet and you have NT user logins, you can use the Request.ServerVariables("LOGON_USER") variable for the username. You might have to strip the domain off it, something like:

dim sUserID
dim iBackSlashPosition
iBackSlashPosition = instr(1, request.servervariables("LOGON_USER"), "\")
sUserID = mid(request.servervariables("LOGON_USER"), iBackSlashPosition + 1, len(request.servervariables("LOGON_USER")))


That's probably not the most efficient, just pulled it from some code I had.