M
Manfred Braun
Hi All,
In my [global.asa's], I will decrement a counter, like :
protected void Session_End(Object sender, EventArgs e)
{
ActiveSessionCount--; //CRASH !!
}
But, unexpectedly, it give me an "Global_asax]System.NullReferenceException:
Object reference not set to an instance of an object." at line [above] and
line [below].
I handle the increment/decrement of my session-counter with the code below:
protected static int ActiveSessionCount
{
get {
HttpContext.Current.Application.Lock(); //CRASH!!
int i = activeSessionCount; // private static declared.
HttpContext.Current.Application.UnLock();
return i;
}
set {
HttpContext.Current.Application.Lock();
activeSessionCount = value;
HttpContext.Current.Application.UnLock();
}
}
Why can the "HttpContext.Current.Application.Lock();" return a
NullReferenceException??? I am not able to understand this! Any help would
really be very welcomed!!!!
Best regards,
Manfred Braun
(Private)
Mannheim
Germany
mailto:[email protected]
(Remove the anti-spam-underscore to mail me!)
In my [global.asa's], I will decrement a counter, like :
protected void Session_End(Object sender, EventArgs e)
{
ActiveSessionCount--; //CRASH !!
}
But, unexpectedly, it give me an "Global_asax]System.NullReferenceException:
Object reference not set to an instance of an object." at line [above] and
line [below].
I handle the increment/decrement of my session-counter with the code below:
protected static int ActiveSessionCount
{
get {
HttpContext.Current.Application.Lock(); //CRASH!!
int i = activeSessionCount; // private static declared.
HttpContext.Current.Application.UnLock();
return i;
}
set {
HttpContext.Current.Application.Lock();
activeSessionCount = value;
HttpContext.Current.Application.UnLock();
}
}
Why can the "HttpContext.Current.Application.Lock();" return a
NullReferenceException??? I am not able to understand this! Any help would
really be very welcomed!!!!
Best regards,
Manfred Braun
(Private)
Mannheim
Germany
mailto:[email protected]
(Remove the anti-spam-underscore to mail me!)