Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing web.config connectionStrings section centrally

Status
Not open for further replies.

LFCfan

Programmer
Nov 29, 2002
3,015
GB
ASP.NET 2.0 environment.

I have to change connection strings in all of our websites' web.config files... and it's a lot of files!

I was hoping to be able to use an external config file for this, and place it somewhere where all apps could read it, but it turns out that something like:
Code:
<connectionStrings configSource="./ConfigFileSections/ConnectionStringsMaster.config"/>
or
Code:
<connectionStrings configSource="c:\ConfigFileSections\ConnectionStringsMaster.config"/>

is not permissible, as the configSource attribute must be a relative physical path.


In theory I suppose one could store connection strings in the machine.config - however that not only feels wrong, but also as far as I can tell would require codebehind changes, which is not an option at this stage

Has anyone had a similar situation? Or got any suggestions?
I would appreciate any advice

Thanks

~LFCfan

 
If you can't make any code changes, I think you will be stuck with editing them in a text editor (most decent editors will let you open all the files and make the changes in one Find/Replace though so it shouldn't be too time consuming).

Mark,

[URL unfurl="true"]http://lessthandot.com[/url] - Experts, Information, Ideas & Knowledge
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Website Design
[URL unfurl="true"]http://aspnetlibrary.com[/url] - An online resource for professional ASP.NET developers
 
Thanks Mark - I feared as much.
Now to find a free text editor that will help me do this...

~LFCfan

 
Thanks Mark
I've decided I might as well code it in C# (make it a bit more fun!)

~LFCfan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top