ASP.NET 2.0 Hosting (Root and Sub Direct with Different Web.Config in Same Domain)

Discussion in 'ASP.NET 2.0' started by sunobject, Mar 1, 2007.

  1. </o:p>
    Hi,
    </o:p>
    I want to config Production Server Database and Staging Server Database Connection String in Same Application depends on Location path.
    </o:p>

    1. <LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in">Example. www.webapp.com (Root Directory)
    When I browse this site the production DataBase Server Connection String should be called through Web.Config of root directory.
    </o:p>

    1. <LI class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-list: l0 level1 lfo1; tab-stops: list .5in">Example. www.webapp.com/LiveBeta (here ?LiveBeta? is a Sub Directory)
    </o:p>
    When I browse this site the Staging (Testing) Database Server Connection String should be called through Web.Config of sub directory.
    </o:p>
    Both the root and sub directory are same application.
    </o:p>
    How can I maintain both the application in one server with different Web.Config files depending on the directories?
    </o:p>
    I tried it out but received the error as connection string conflict.
    </o:p>
    How can toggle this issue in ASP.NET 2.0 with 2 Database in same server?
    </o:p>
    It's very urgent one.
    </o:p>
    Thank you

    Sundar
     
  2. You could define your own config section, and have nodes for each enviro tagged appropriately.Writean implementation ofIConfigurationSectionHandler to read the section and there you go.





    <section name="Sundars.appConfig"


    type="Sundars.AppConfigSectionHandler,Sundars"/>





    <Sundars.appConfig>


    <!-- [Your enviro specific stuff here] -->


    <config Config.ServerName="PROD"


    Config.ApplicationPath="?"


    SQL.ConnectString="Application Name=?;Data Source=?;Initial Catalog=?;Connect Timeout=30;Integrated Security=SSPI"


    ...ETC="?"


    />


    <config Config.ServerName="TEST"


    Config.ApplicationPath="?"


    SQL.ConnectString="Application Name=?;Data Source=?;Initial Catalog=?;Connect Timeout=30;Integrated Security=SSPI"


    ...ETC="?"


    />


    </Sundars.appConfig>
     
  3. Hi,


    Thank you for your help.





    Thank you


    Sundar
     

Share This Page