amillyard
asked on
session variable / datetime
c sharp .net
have a couple of Session Variables:
protected void Session_Start(object sender, EventArgs e)
{
Session.Add("serverTimeAdj ustment", 6);
Session.Add("todaysDateTim eServerAdj usted", DateTime.Now.AddHours(Sess ion["serve rTimeAdjus tment"]));
}
When I want to retieve this variable elsewhere in the web app, I use the following:
DateTime reportingDateTime = (DateTime)Session["todaysD ateTimeSer verAdjuste d"];
Compiling is fine - but the debugger is then complaining when running ... and the following error on the above line:
'Object reference not set to an instance of an object.'
have a couple of Session Variables:
protected void Session_Start(object sender, EventArgs e)
{
Session.Add("serverTimeAdj
Session.Add("todaysDateTim
}
When I want to retieve this variable elsewhere in the web app, I use the following:
DateTime reportingDateTime = (DateTime)Session["todaysD
Compiling is fine - but the debugger is then complaining when running ... and the following error on the above line:
'Object reference not set to an instance of an object.'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER