Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: web.config and cache


Message #1 by "J House" <jesse@s...> on Sat, 25 Jan 2003 22:37:38
wondering if the contents of web.config is already loaded into cache, and 
if there is any benefit loading data from web.config into cache variables? 
faster access?.

i.e. web.config
<add key="ConnectionString" value="SERVER=abc; DATABASE=xyz; UID=sa; 
PWD=;" />
<add key="OtherImportantInfo" value="some value" />

1. access directly from config file in an aspx page
string connection = System.Configuration.ConfigurationSettings.AppSettings 
["ConnectionString"];

2. or load into cache during Application_Start in global.asax
Context.Cache ["ConnectionString"] = 
System.Configuration.ConfigurationSettings.AppSettings 
["ConnectionString"];

then in aspx page
string connection = Cache["ConnectionString"].ToString ()

is there any performance benefit to #2 ?

any feedback would be appreciated.

  Return to Index