Re: Multiple config files

Re: Multiple config files

am 20.04.2008 10:20:52 von Peter Schwartz

Option 1: Create your own XML files. Name them whatever you like - even with
a .config extension (as long as the rest of the name doesn't conflict with
the convention expected by .NET, which is ApplicationName.config - the name
that Web.config takes after compilation). Then read your XML files as plain
ole' XML documents, parsing out your configuration values however you like.

Option 2: Store your config values in a database and retrieve them as
necessary and/or during Application_Start.

Option 3: Have multiple Web.config files. In order to do this, the files
must exist at different levels in, or relative to, the application. Config
files can or do exist at the server level, the site level (in the site
root), or in sub folders. If in sub folders, then the settings apply to only
the pages etc within the respective sub folders. But as far as having
multiple config files at the same "level" (e.g., in the site root), I
believe this is not possible, unless you go witth reading them as plain ole'
XML documents and not reading them via the .NET configuration system.

-HTH


"Fresno Bob" wrote in message
news:00F25AB6-7D05-405D-9B98-C2F553493539@microsoft.com...
>I quite like to store variables in the web.config file. However it can make
>the web.config messy and make deployment fiddly. Is there any way of have
>multiple web.config files - one with the major stuff and one with minor
>stuff such as my variables which can differ from development to production.
>Or alternatively is there some kind of tool to make the deployment
>smoother? Regards, Chris.
>

Re: Multiple config files

am 20.04.2008 11:32:41 von Patrice

Plus :

- I remember to ahve seen that you can reference include files from your
web.config file (made a qucik search and it looks like this is done using
the configSource attribute)

- you can put all settings in a single web.config file and retrieve the
appropriate section/entry based on the current host name

--
Patrice



"Robert Cramer" a écrit dans le message de news:
e2LRz9roIHA.4912@TK2MSFTNGP03.phx.gbl...
> Option 1: Create your own XML files. Name them whatever you like - even
> with a .config extension (as long as the rest of the name doesn't conflict
> with the convention expected by .NET, which is ApplicationName.config -
> the name that Web.config takes after compilation). Then read your XML
> files as plain ole' XML documents, parsing out your configuration values
> however you like.
>
> Option 2: Store your config values in a database and retrieve them as
> necessary and/or during Application_Start.
>
> Option 3: Have multiple Web.config files. In order to do this, the files
> must exist at different levels in, or relative to, the application. Config
> files can or do exist at the server level, the site level (in the site
> root), or in sub folders. If in sub folders, then the settings apply to
> only the pages etc within the respective sub folders. But as far as having
> multiple config files at the same "level" (e.g., in the site root), I
> believe this is not possible, unless you go witth reading them as plain
> ole' XML documents and not reading them via the .NET configuration system.
>
> -HTH
>
>
> "Fresno Bob" wrote in message
> news:00F25AB6-7D05-405D-9B98-C2F553493539@microsoft.com...
>>I quite like to store variables in the web.config file. However it can
>>make the web.config messy and make deployment fiddly. Is there any way of
>>have multiple web.config files - one with the major stuff and one with
>>minor stuff such as my variables which can differ from development to
>>production. Or alternatively is there some kind of tool to make the
>>deployment smoother? Regards, Chris.
>>
>
>
>

Re: Multiple config files

am 20.04.2008 13:07:28 von Jesse Hand

>I quite like to store variables in the web.config file. However it can make
>the web.config messy and make deployment fiddly. Is there any way of have
>multiple web.config files - one with the major stuff and one with minor
>stuff such as my variables which can differ from development to production.
>Or alternatively is there some kind of tool to make the deployment smoother?

You can define a "configSource=........" attribute for just about
every section in your web.config, to "externalize" your config
settings to separate files:





...





.......


........


Those external config files now simply contain the section that you
would normally have directly in your web.config, e.g.

connectionStrings.config:







That alone can make your web.config a lot more readable right there -
and it's totally built in, no extra custom code needed - nada.

Hope this helps.
Marc

Multiple config files

am 20.04.2008 18:20:01 von DFS

I quite like to store variables in the web.config file. However it can make
the web.config messy and make deployment fiddly. Is there any way of have
multiple web.config files - one with the major stuff and one with minor
stuff such as my variables which can differ from development to production.
Or alternatively is there some kind of tool to make the deployment smoother?
Regards, Chris.

Re: Multiple config files

am 22.04.2008 20:25:34 von DFS

I'll have a look at that. It looks like exactly what I'm looking for.
Cheers.

"Marc Scheuner" wrote in message
news:gn8m04pnotrs098kpeqltra9c65ihmbc5p@4ax.com...
> >I quite like to store variables in the web.config file. However it can
> >make
>>the web.config messy and make deployment fiddly. Is there any way of have
>>multiple web.config files - one with the major stuff and one with minor
>>stuff such as my variables which can differ from development to
>>production.
>>Or alternatively is there some kind of tool to make the deployment
>>smoother?
>
> You can define a "configSource=........" attribute for just about
> every section in your web.config, to "externalize" your config
> settings to separate files:
>
>
>
>
>
> ...
>

>

>
>
>
> .......
>

>
> .......
>

>
> Those external config files now simply contain the section that you
> would normally have directly in your web.config, e.g.
>
> connectionStrings.config:
>
>
>
>
>

>
>
> That alone can make your web.config a lot more readable right there -
> and it's totally built in, no extra custom code needed - nada.
>
> Hope this helps.
> Marc