Authenticate.asp
<%
Dim URL
URL = Request.QueryString
'GetUrl.
%>
<body>
<form method=post action= "/validate.asp" >
<input type=hidden name= "URL" value= "<%=URL%>" >
'url Save to a hidden variable username :
<input Type=text name= "txtname"
password Span lang= "en-us":
<input type=password name= "Txtpassword"
<input type=submit>
</form>
</body> validate.asp file gets the information passed to it, reads the username and password from the database to determine whether to authorize the user.
Validate.asp
<%
Dim strUserName, Strpassword
strUserName = Request.Form ("Txtname")
strpassword = Request.Form ("Txtpassword")
' read the user name and password from the form .
' establish a database connection ...
Dim strSQL
strSQL = "SELECT * from validusers WHERE UserName =" & _
strUserName & "and Password =" & _
Strpassword
' for SQL queries .
Dim RS
Set rs = Conn.execute (strSQL)
If Rs. EOF Then
' The user name is valid if the recordset is not empty .
Session ("bolauthenticated") = True
' set bolauthenticated to True.
Response.Redirect Request.Form ("URL")
' pass the user a URL that has come .
Else
Response.Redirect "/notvalidated.asp
',
End If
%>
[1]