Session Variables and Dates
I am trying to set a session variable to pass between pages. It only seems to work if I print the variable to the page before I try to reference the variable. The code setting the variable is:
<%
var varStartDate = new Date();
Session("varStartDate") = varStartDate;
var strStartDate = (Session("varStartDate").getMonth() + 1) + "/" + Session("varStartDate").getDate() + "/" + Session("varStartDate").getFullYear();
Session("strStartDate") = strStartDate;
%>
<SCRIPT LANGUAGE = JavaScript>
window.top.main.location='DisplayMonthlySchedule.a sp';
</SCRIPT>
Using this code, when "DisplayMonthlySchedule.asp" runs, I get an error:
Response object error 'ASP 0185 : 8000ffff'
Missing Default Property
/Scheduling/DisplayMonthlySchedule.asp, line 162
A default property was not found for the object.
If I change the original code to (change in red):
<%
var varStartDate = new Date();
Session("varStartDate") = varStartDate;
var strStartDate = (Session("varStartDate").getMonth() + 1) + "/" + Session("varStartDate").getDate() + "/" + Session("varStartDate").getFullYear();
Session("strStartDate") = strStartDate;
%>
varStartDate = <%=Session("varStartDate")%><br>
strStartDate = <%=Session("strStartDate")%><br>
<SCRIPT LANGUAGE = JavaScript>
window.top.main.location='DisplayMonthlySchedule.a sp';
</SCRIPT>
Things work just fine. The problem is that I don't want these dates showing up on the browser. Anyone know what this error means and how to eliminate it?
It appears that:
Session("strStartDate") = strStartDate; this passes fine
Session("varStartDate") = varStartDate; this generates error above
Thanks for your help!
Rich
__________________
Ego is a faithful friend; He stays with us all the way to the crater.
|