Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 17, 2012 04:12 AM by shree_ars
Participant
1395 Points
776 Posts
Jul 04, 2012 09:24 AM|LINK
Is it possible to create child .config file in .net
my need is right now i have dumped all configurations such as (connectionstring, exception....etc) are in single .config file
i need to split into seperate one.. such as
one main .config
and 2 or 3 sub config which are also interconnected with main.config and also 2 and 3 also get interconnected.
any solution for this..
thanks in advance
Star
12255 Points
1841 Posts
Jul 04, 2012 09:28 AM|LINK
You can define configsource attribute in web.config for external config files.
<?xml version='1.0' encoding='utf-8'?> <configuration> <connectionStrings configSource="connections.config"/> </configuration>
Check following:
http://www.codeproject.com/Articles/20817/Manage-Web-config-from-XML-File-by-using-configSou
You can use file attribute also:
http://trycatchfail.com/blog/post/Webconfig-magic-configSource-and-file-attributes.aspx
Contributor
2064 Points
324 Posts
Jul 04, 2012 09:30 AM|LINK
Hi,
using ConfigSource attribute we can split the configuration into more than one file.
Please have a look
http://stackoverflow.com/questions/428573/managing-complex-web-config-files-between-deployment-environments
http://www.davidturvey.com/blog/index.php/2009/10/how-to-split-the-web-config-into-mutliple-files/
Jul 04, 2012 09:59 AM|LINK
Hi guys..thanks for the reply..
see all samples are relates to Connectionstring...which is direct approach by using ConfigSource..
but my need is
i have
1) connection string
2) Exceptionhandling
3) UnityContainer (which uses both connectionstring and exceptionhandling)
so if we placed all three parts as seperate .config..how we communicate between three... ?
1977 Points
256 Posts
Microsoft
Jul 06, 2012 06:56 PM|LINK
Many (most?) elements in web.config support the configSource attribute. For example, connectionStrings, appSettings, customErrors, authorization...
Jul 16, 2012 06:37 AM|LINK
In my config file i have unity part configuration.
now i need to seperate this unity configuration to seperate config file and map this new config file to main config
how to do it....any solution or possible way of do this?
Jul 17, 2012 04:12 AM|LINK
yes i got the solution.
For each config section that we add in main configuration file(web.config or app.config) we can make sub configuration file.
while creating sub config file these need to be taken care
1) sub config file should not contain configuration node(i.e its parent node)
2) only one config section should be defined in single sub config file
In order to map the sub sonfig file in main config
just add "configSource" to the corresponding section node..this will map the sub configuration values.
for connection string we already have "configSource" property, but for others we can add manually.
shree_ars
Participant
1395 Points
776 Posts
.config split into multiple config file
Jul 04, 2012 09:24 AM|LINK
Is it possible to create child .config file in .net
my need is right now i have dumped all configurations such as (connectionstring, exception....etc) are in single .config file
i need to split into seperate one.. such as
one main .config
and 2 or 3 sub config which are also interconnected with main.config and also 2 and 3 also get interconnected.
any solution for this..
thanks in advance
urenjoy
Star
12255 Points
1841 Posts
Re: .config split into multiple config file
Jul 04, 2012 09:28 AM|LINK
You can define configsource attribute in web.config for external config files.
<?xml version='1.0' encoding='utf-8'?> <configuration> <connectionStrings configSource="connections.config"/> </configuration>Check following:
http://www.codeproject.com/Articles/20817/Manage-Web-config-from-XML-File-by-using-configSou
You can use file attribute also:
http://trycatchfail.com/blog/post/Webconfig-magic-configSource-and-file-attributes.aspx
ramanselva
Contributor
2064 Points
324 Posts
Re: .config split into multiple config file
Jul 04, 2012 09:30 AM|LINK
Hi,
using ConfigSource attribute we can split the configuration into more than one file.
Please have a look
http://stackoverflow.com/questions/428573/managing-complex-web-config-files-between-deployment-environments
http://www.davidturvey.com/blog/index.php/2009/10/how-to-split-the-web-config-into-mutliple-files/
This can be beneficial to other community members reading the thread.
Regards,
Rama Selvam M.
shree_ars
Participant
1395 Points
776 Posts
Re: .config split into multiple config file
Jul 04, 2012 09:59 AM|LINK
Hi guys..thanks for the reply..
see all samples are relates to Connectionstring...which is direct approach by using ConfigSource..
but my need is
i have
1) connection string
2) Exceptionhandling
3) UnityContainer (which uses both connectionstring and exceptionhandling)
so if we placed all three parts as seperate .config..how we communicate between three... ?
jamlew
Participant
1977 Points
256 Posts
Microsoft
Re: .config split into multiple config file
Jul 06, 2012 06:56 PM|LINK
Many (most?) elements in web.config support the configSource attribute. For example, connectionStrings, appSettings, customErrors, authorization...
- Jimmy Lewis
Microsoft SDET
Visual Web Developer Team
shree_ars
Participant
1395 Points
776 Posts
Re: .config split into multiple config file
Jul 16, 2012 06:37 AM|LINK
In my config file i have unity part configuration.
now i need to seperate this unity configuration to seperate config file and map this new config file to main config
how to do it....any solution or possible way of do this?
shree_ars
Participant
1395 Points
776 Posts
Re: .config split into multiple config file
Jul 17, 2012 04:12 AM|LINK
yes i got the solution.
For each config section that we add in main configuration file(web.config or app.config) we can make sub configuration file.
while creating sub config file these need to be taken care
1) sub config file should not contain configuration node(i.e its parent node)
2) only one config section should be defined in single sub config file
In order to map the sub sonfig file in main config
just add "configSource" to the corresponding section node..this will map the sub configuration values.
for connection string we already have "configSource" property, but for others we can add manually.