i m trying to execute a simple code which uses login information ..and after validating data (ie username and password) it stores these values in session objects and redirects to a different page where it confirms the session name before continuing..pro blem is when data is validated and redirection is done to different page,it gives an error that object is no longer valid..
some part of code...
login.asp:::
strSQL="SELECT * FROM tblLoginInfo WHERE username='"+str Username+"' AND password='"+str Password+ "';";
var conn = Server.CreateOb ject("ADODB.Con nection");
var dsnname="DSN=sh ipass";
conn.mode=3;
conn.Open(dsnna me);
var rs=conn.Execute (strSQL);
if((rs.EOF))
{Session("usern ame") = "";
strURL = "";
%>
<p>
<font size="4" face="arial,hel vetica"><strong >
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="login.asp ">Try Again</a>
</p>
<%
}
else
{Session("usern ame") = rs("username") ;
Session.Timeout =50;
strURL = rs("destination ");
Response.Redire ct("user.asp") ;
}
rs.Close();
conn.Close();
}
user.asp::
<%@ Language="javaS cript" %>
<%
if(Session("use rname")!="anna" )
Response.Redire ct("httP://localhost/login.asp");
else
{
%>
<html>
<head>
<title>User page</title>
</html>
some part of code...
login.asp:::
strSQL="SELECT * FROM tblLoginInfo WHERE username='"+str Username+"' AND password='"+str Password+ "';";
var conn = Server.CreateOb ject("ADODB.Con nection");
var dsnname="DSN=sh ipass";
conn.mode=3;
conn.Open(dsnna me);
var rs=conn.Execute (strSQL);
if((rs.EOF))
{Session("usern ame") = "";
strURL = "";
%>
<p>
<font size="4" face="arial,hel vetica"><strong >
Login Failed - Please verify username and password.
</strong></font>
</p>
<p>
<a href="login.asp ">Try Again</a>
</p>
<%
}
else
{Session("usern ame") = rs("username") ;
Session.Timeout =50;
strURL = rs("destination ");
Response.Redire ct("user.asp") ;
}
rs.Close();
conn.Close();
}
user.asp::
<%@ Language="javaS cript" %>
<%
if(Session("use rname")!="anna" )
Response.Redire ct("httP://localhost/login.asp");
else
{
%>
<html>
<head>
<title>User page</title>
</html>
Comment