Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kyle Skrinak 272 posts 327 karma points
    Jul 25, 2009 @ 23:33
    Kyle Skrinak
    0

    Conditional sql server selection in web.config?

    I would love if I could do something like:

    If 

    <add key=umbracoDbDSN" value=serverXcnxstring />

    else

    <add key=umbracoDbDSN" value=serverYcnxstring />

    Where X is a sql server that only I can access (local environment) and Y is the live string. My guess is that the process doesn't return a result so this won't work.
    Is this possible; or what's the "right" way to do this so I don't have to modify my web.config as I move my data to and fro?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Jul 25, 2009 @ 23:53
    Dirk De Grave
    0

    Hi Kyle,

     

    Might have a look at this article from the guys at the farm digital, especially on how they handle such situtations.

     

    Cheers,

    /Dirk

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 25, 2009 @ 23:58
    Peter Dijksterhuis
    0

    Alternatively, you could hook into the Application_Start() and set the value there perhaphs (based on host)? Haven't tried it, so I'm not sure if that'll even work.

  • Kyle Skrinak 272 posts 327 karma points
    Jul 26, 2009 @ 16:24
    Kyle Skrinak
    0

    Thanks guys -- I'll just do the lazy thing and shift the commenting as I move the web.config back and forth.

  • Paul Blair 466 posts 731 karma points
    Jul 27, 2009 @ 06:49
    Paul Blair
    1

    What I do is not release the web.config with the rest of my files - especially once the site has gone live. At this stage I make any changes manually to the web.config.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies