Oundless
Oundless

Reputation: 5505

ASP.NET Web.config AppSettings Performance

I have a number of appSettings in web.config that are used frequently (i.e. on each post back). Does the ConfigurationManager hold these values in process or are there any performance gains to be had by copying these values into application state on ApplicationStart() and subsequently retrieving them from there?

Upvotes: 10

Views: 2960

Answers (1)

Vinay Sajip
Vinay Sajip

Reputation: 99297

AFAIK the configuration is read and parsed at startup and the data is held in memory thereafter. I don't believe any performance gains from caching the state in application variables will be significant - though you may get improved readability as you don't litter the code with ConfigurationManager.AppSettings[...].

Upvotes: 11

Related Questions