Should I put custom AppSettings web.config data into the ApplicationState?

473 views Asked by At

I've got some custom values in the AppSettings, in my web.config file.

These values get checked upon every Request. (Please ignore the fact that this might be a bad/good thing .. that's out of scope of the question).

eg.

So if every request checks the web.config file for the value of this key, would be be smart to put this into the Application cache (eg. via the global.asax) instead of checking this value EVERY request?

I'm assuming that when we read a value from the AppSettings, the website does a physical read of the web.config file? or is this information also all read into Memory when the website starts up and all references to any appSettings information is just an inmemory read .. not a disk I/O read?

2

There are 2 answers

0
Guilherme de Jesus Santos On BEST ANSWER

The WebConfig is cached. Just at the first request of the website does a physical read. All the others requests use the cache data. This is why when you change the web.config file and call a request your site will have a little delay, because the information in web.config is being recached.

0
Steve Wellens On