Questions and Answers on any aspect of .NET. Now closed.
Are the app settings I specify in web.config stored in memory while the application is running or are they read from the hard disk every time I want to access one.
I'm wondering if I should worry about caching the values as I access them?
i.e. Is this necessary:
public Shared readonly property WebRequestURL() As String
Dim temp As String = HttpContext.Current.Cache("webreqeusturl")
If temp Is Nothing Then
'read it from web.config
temp = System.Configuration.ConfigurationManager.AppSettings("webrequesturl")
HttpContext.Current.Cache("webrequesturl) = temp
My understanding is that the config is read and parsed at startup and the reading of config values happens from an in-memory cache of the config file. The application does not access (via disk IO) the file each time a value is requested.
You're use of the cache is somewhat redundant in that the file's contents are already cached. So there's no need to do what you've proposed.
Hope that helps!!
If this weren't the case, wouldn't you want the read to happen once per application instead of once per session? Somehting like:
Application("MyVar") = ...
Friday, January 26, 2007
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz