ConfigurationSettings vs Application State

M

[myfirstname]

Hello

I've seen several examples around the web where people put all the
values in ConfigurationSettings.AppSettings into Application State
variables in global.asax, like this:

foreach (string key in ConfigurationSettings.AppSettings.Keys) {
Application[key] = ConfigurationSettings.AppSettings[key];
}

Does ASP.NET retreive values from Application faster than from
ConfigurationSettings.AppSettings or what's the point of this?

Just wondering if I should do the same or not...

/Mikael
 
T

Teemu Keiski

ConfigurationSettings are cached and Application comes from memory so
basically there isn't so much difference in performance. It's more about the
ability to change the information given to the application.

In .NET v1 configurationsettings in .config files are read-only and more
static by their nature. Application again
could store data without user intervention as the logic requires/does though
people probably use Cache instead of Application because of its better
features from the box. Basically if you want to change configuration yo
don't have to recompile the app, but if you change something in Application
variable, you'd need to recompile the application.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


Hello

I've seen several examples around the web where people put all the
values in ConfigurationSettings.AppSettings into Application State
variables in global.asax, like this:

foreach (string key in ConfigurationSettings.AppSettings.Keys) {
Application[key] = ConfigurationSettings.AppSettings[key];
}

Does ASP.NET retreive values from Application faster than from
ConfigurationSettings.AppSettings or what's the point of this?

Just wondering if I should do the same or not...

/Mikael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top