Hello John Timney and Andrea Williams,
I also have the same problem with Andrea Williams.
My designing goal is that:
1. The global values can be changed,
2. if they are changed, they can be stored back,
3. Retrieving them would not yield too much load to the server
(quick and easy to fetch)
4. Altering them won't have the application restart.
5. Variables have default values.
Thus,
1. Storing values in Web.Config is not a feasible way since
modifying that file will restart the application.
2. Storing values in Global.asax is not feasible too, since the
changed values can not be saved between application restarts.
3. Storing values in an external database is expensive to load
values.
Regarding this, i designed a model:
1. Variable values are stored in an external database;
2. On Application_start, the appication will attempt to load values
into the global variable, the ApplicationState Items, from the
database (if the loading process failed, i set a WebSiteSuspended
global variable to True, the following request will continue to
reload from the database still, and set WebSiteSuspended to
False if the database is ready and values are loaded)
3. On Application_end, the application will attempt to save all
global variable back to the database, from the ApplicationState
Items.
4. There's also viable to store values back to the database during
the runtime of the application, periodically.
5. Default values are hard coded in the Global.asax. If there's no
corresponding value in the database, the default value is applied.
after loading the values, to ensure that the following application
pages, controls can directly get the value from
Application["var_name"] without having to determine whether
the value exists.
How do you think about this model? Any suggestions, please!
Jordan