This topic is locked

Pass Thru authentication with domain user name

5/3/2004 1:57:27 PM
ASPRunnerPro General questions
C
cmorfunk author

Hi,

I've checked around on some other ASP forums but wondered if you could suggest a simple solution to using pass-thru authentication for the login page...basically I would like to use the Request.ServerVariable("AUTH_USER") to authenticate the user comparing the raw domain user name against a SQL table similarly to how your login routine works but bypassing the need for the user to interact by submitting the login information..any suggestions ?
Thanks in advance.

Sergey Kornilov admin 5/4/2004

Here is the sample code that you can use. You can place it to the login page and remove all input boxes that ask username and password.

Set rs = server.CreateObject("ADODB.Recordset")

set dbConnection = server.CreateObject("ADODB.Connection")

dbConnection.ConnectionString = strConnection

dbConnection.Open

Call ReportError
strSQL = "select * from LoginTable where UserNameField='" & Request.ServerVariable("AUTH_USER")  & "'"

rs.open strSQL, dbConnection

Call ReportError 
If Not rs.EOF Then

    Session("UserID") = Request.ServerVariable("AUTH_USER")

    Response.Redirect list.asp
else

    Response.Write "Login failed"

end if


You just need to replace table and field names in bold with real names.
I hope this helps.