I want to maintain the session into html pages but I have problem of finding a way to pass the session variables into html pages. So this is my login.asp code.


var Conn=Server.CreateObject("ADODB.Connection");
var DSN="DSN=file";

var Rst=Server.CreateObject("ADODB.Recordset");
var sql = "SELECT nme,userid,userpwd FROM student WHERE userid="+Request.Form("userid")+"AND userpwd='"+Request.Form("userpwd")+"'";

    var user;
    Response.Write("Hi "+Session("nme")+"!. Welcome Back.Good to see you again. Redirect to homepage in 3 seconds");
    Response.Write("<br />");
    Response.Write("<a href='logout.asp'>Logout</a>");





Recommended Answers

All 2 Replies

When redirecting, you need to redirect to other .asp pages. You cannot access the session variable(s) in .htm pages. You should be building .asp pages within your web application so that you can include server side scripting in those pages to access the session variable(s).

What about adding the session stuff into a cookie or two and then retrieving the cookies with javascript inside of the htm pages? That could work. Just a thought.

Be a part of the DaniWeb community

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