O
oliv
Hi,
new to .NET, I need some unique var among the whole application in
during the whole lifecycle of the webapp.
This var is a Boolean :
at start time of the webapp, I want this var to be set as false
I did that through a file Global.asax
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup --
Application["isStarted"] = false;
....
Is that the proper way ?
Then I use this var among the different pages. Some instance of the
page can read or change the value of this var.
My problem, is that after some while runing , the var seems to be
removed from the Application and I get this error message
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
Line 43: else if ((((Boolean)Application["isStarted"]) ==
false)
thanks for help
new to .NET, I need some unique var among the whole application in
during the whole lifecycle of the webapp.
This var is a Boolean :
at start time of the webapp, I want this var to be set as false
I did that through a file Global.asax
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup --
Application["isStarted"] = false;
....
Is that the proper way ?
Then I use this var among the different pages. Some instance of the
page can read or change the value of this var.
My problem, is that after some while runing , the var seems to be
removed from the Application and I get this error message
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
Line 43: else if ((((Boolean)Application["isStarted"]) ==
false)
thanks for help