Protecting ASP pages with a login
Posted on 2005-04-08
I am trying to protect all my asp files with a login function. The function means that anyone trying to access any of the protected asp pages can't gain access unless they are logged in, and if they try to do so are taken straight to the login page. When i run the code though i receive this error.
Request object, ASP 0102 (0x80004005)
The function expects a string as input.
/logon.asp, line 5
Here is the code that runs the protection function.
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Conn.Execute ("SELECT * From tblMember WHERE username = " & Request.Form(username)& " AND password =" & Request.Form(password) & ";")
Do until RS.EOF
Pass = RS("password")
Name = RS("username")
IF Pass = "" Then
Message = "The Password you entered is either wrong or not found in our database. Please press the back button and try again."
Session("password") = Pass
Session("username") = Name
IF Session("Ori_URL") = "" Then 'do nothing
My knowledge of sql is very limited, and i can't see why this doesn't work. It seems to link in with my access database fine but fall down at the Set RS line. Any help would be fantastic as regardless of what combination of code i try i can't get it to work.