c sharp .net
have a couple of Session Variables:
protected void Session_Start(object sender, EventArgs e)
{
Session.Add("serverTimeAdjustment", 6);
Session.Add("todaysDateTimeServerAdjusted", DateTime.Now.AddHours(Session["serverTimeAdjustment"]));
}
When I want to retieve this variable elsewhere in the web app, I use the following:
DateTime reportingDateTime = (DateTime)Session["todaysDateTimeServerAdjusted"];
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.'
Open in new window