web config file section replacements

T

ThatsIT.net.au

I have been looking into web config file section replacements
I have set it buy putting in the line into the deploy section
connectionStrings=connectionStrings.config;

I then have a file by that name in the root directory

with

<?xml version="1.0"?>
<connectionStrings>
<add name="ioSQL" connectionString="my connection string"/>
</connectionStrings>

if I add another connection string to my web.config it tells me that they
cannot merge so I know that the file is being found, but in debug or release
it uses the same connection string from web.config

Am I missing a step?
 
J

Juan T. Llibre

re:
!> I have been looking into web config file section replacements
!> I have set it buy putting in the line into the deploy section
!> connectionStrings=connectionStrings.config;
!> I then have a file by that name in the root directory
!> Am I missing a step?

You are missing the configSource attribute in web.config :

<connectionStrings configSource="subdirectory/connectionStrings.config"/>

or, if connectionStrings.config is in the root of the application :

<connectionStrings configSource="connectionStrings.config"/>
 
T

ThatsIT.net.au

Juan T. Llibre said:
re:
!> I have been looking into web config file section replacements
!> I have set it buy putting in the line into the deploy section
!> connectionStrings=connectionStrings.config;
!> I then have a file by that name in the root directory
!> Am I missing a step?

You are missing the configSource attribute in web.config :

<connectionStrings configSource="subdirectory/connectionStrings.config"/>

or, if connectionStrings.config is in the root of the application :

<connectionStrings configSource="connectionStrings.config"/>


Thanks for your replay and sorry for getting back so late.

if I was to have this in my web.config
<connectionStrings configSource="connectionStrings.config"/>

how would it find the debug file.

If I have 2 files one for debug and one for release, how can I specify both?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top