Hi, I need some help with ASP. I''m only familiar with the language but now I have to do project.

I have 3 pages: login.asp, login_script.asp and admin.asp and i'm using access database

When the user logs into the login.asp page, it checks the database to see if that username and password exist, if so, the forms sends it to the login_script.asp and redirect to admin.asp.

Well my script seems to stalled at login_script.asp and refuses to redirect to admin.asp. Like it never gets pass that point. Can someone please help me? Thanks for your time!

database: tnt.mdb, table: user
Fields: loginType, usersname, password, loginType, Company, status

login.asp

<form name="form1" method="post" action="login_script.asp">
           <table width="100%"  border="0" cellspacing="0" cellpadding="5">
               <tr>
                 <td align="right">Username:</td>
                 <td width="439"><input name="username" type="text" class="field" id="username"></td>
               </tr>
               <tr>
                 <td align="right">Password:</td>
                 <td><input name="Password" type="password" class="field" id="Password"></td>
               </tr>
               <tr>
                 <td align="right">&nbsp;</td>
                 <td><input type="submit" name="Submit" value="Submit">
                 <input type="reset" name="Submit2" value="Reset"></td>
               </tr>
           </table>
         </form>

the login_script.asp code:

<%
usersname=request.form("Usersname")
password=request.form("Password")

If Request.Form("username") = "" AND Request.Form("password") = "admin" Then
Session("loggedIn") = True
Response.Redirect "admin.asp"

end if
%>

admin.asp

<!--#include virtual="connection.asp"-->
<%
if session("loggedin") <> "admin" then
	 response.redirect "login_admin.asp"
end if
%>

the connection.asp

<%
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Mode = 3
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\Inetpub\wwwroot\vmSight\database\tnt.mdb"
%>

Correct me if I am wrong, but response.redirect "login_admin.asp" can't work because there isn't such script!

Correct, from the looks of it, that should be response.redirect "login_script.asp"

Hi Thanks for the replied. I meant for the redirect to be response.redirect "login_admin_script.asp"

It was my typo. :(

So, does it work now?

The information you just provided still doesn't match what you originally posted and doesn't look like it will work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.