web config file section replacements

Discussion in 'ASP .Net' started by ThatsIT.net.au, Sep 12, 2008.

  1. 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?
    ThatsIT.net.au, Sep 12, 2008
    #1
    1. Advertising

  2. ThatsIT.net.au

    sloan Guest

    Check:
    http://www.eggheadcafe.com/tutorial...180-c1f564b41f85/some-aspnet-20-configur.aspx

    He explains 2.0 stuff (and beyond) well.


    "ThatsIT.net.au" <me@work> wrote in message
    news:...
    >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?
    sloan, Sep 12, 2008
    #2
    1. Advertising

  3. 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"/>




    Juan T. Llibre, asp.net MVP
    asp.net faq : http://asp.net.do/faq/
    foros de asp.net, en español : http://asp.net.do/foros/
    ======================================
    "ThatsIT.net.au" <me@work> wrote in message news:...
    > 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?
    Juan T. Llibre, Sep 13, 2008
    #3
  4. "Juan T. Llibre" <> wrote in message
    news:...
    > 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?





    >
    >
    > Juan T. Llibre, asp.net MVP
    > asp.net faq : http://asp.net.do/faq/
    > foros de asp.net, en español : http://asp.net.do/foros/
    > ======================================
    > "ThatsIT.net.au" <me@work> wrote in message
    > news:...
    >> 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?

    >
    >
    ThatsIT.net.au, Sep 27, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian McCullough
    Replies:
    0
    Views:
    492
    Brian McCullough
    Feb 16, 2007
  2. CSharpner
    Replies:
    0
    Views:
    1,012
    CSharpner
    Apr 9, 2007
  3. Jeff Thies

    making replacements in a file

    Jeff Thies, Jul 11, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    107
    Mina Naguib
    Jul 11, 2003
  4. Robert Neville
    Replies:
    4
    Views:
    136
    Mumia W.
    Apr 3, 2007
  5. kampy
    Replies:
    9
    Views:
    326
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page