web.config vs. global.asax

snipahx

New Member
Is there any reason to store values (i.e. a db connection string) in the web.config as opposed to creating an application variable in the global.asax?variables stored in web.config can be accessed directly with a static method, so you don't need to have access to the http application context. In global.asax, if you don't have access to the http application context, for example, when you have a stand alone class that has nothing to do with any aspx, then you will need to get the connection string from the web.config
 
Back
Top