J
Johnson
In a centralized error logging routine I need to determine whether there is
a "current session" - then if there is I log some information stored in the
current session. I have an HTTP Module that logs all otherwise unhandled
exceptions. Sometimes it logs exceptions that apparently are not related to
any particular Session (perhaps they occur before a new Session is
established).
So, I need a line of code that answers the question - "is there a current
session?"
I have this now:
if (System.Web.HttpContext.Current.Session["someVariable"] != null) {
// log stuff about the current Session here
}
BUT it chokes periodically with the exception message, "Object reference not
set to an instance of an object.".
Any suggestions?
Thanks!
a "current session" - then if there is I log some information stored in the
current session. I have an HTTP Module that logs all otherwise unhandled
exceptions. Sometimes it logs exceptions that apparently are not related to
any particular Session (perhaps they occur before a new Session is
established).
So, I need a line of code that answers the question - "is there a current
session?"
I have this now:
if (System.Web.HttpContext.Current.Session["someVariable"] != null) {
// log stuff about the current Session here
}
BUT it chokes periodically with the exception message, "Object reference not
set to an instance of an object.".
Any suggestions?
Thanks!