c# - Centralised Connection String for multiple application asp.net -


i have web server multiple application running. application have web.config file. if database password changes due policy have manually change password in each of web.config files in app setting section.

i reading connection string setting in machine.config file.

now question if put connection string in appsetting section of machine.config name connectionstring , same in web.config file overwrite machine.config file values.

in machine.config following setting

<configuration>   ....   <appsettings>     <add key="connectionstring" value="value"/>   </appsettings> </configuration>  

similarly in web.config file

<configuration>   ....   <appsettings>     <add key="connectionstring" value="value"/>   </appsettings> </configuration>  

and value in code below

string constring=configurationmanager.appsettings["connectionstring"]; 

will overloaded value?

what's going out here store connection string(s) in .config file , reference them either using file="" attribute or configsource="" attribute.

here's excellent question , answer talks differences between 2 , shows how implement them:

asp.net web.config: configsource vs. file attributes


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -