locked
Fast connection string change in IIS site/application RRS feed

  • Question

  • Hello ,

    I have a server with various runnings web sites. E.g: Server1 run:

    a.myenterprise.com
    b.myenterprise.com
    c.myenterprise.com

    Each site, use own sql server. Eg.: Site A use instance named Server1\a. Site B use instance named Server1\b... 

    The connection strings used for connection with sql server is defined with .asp (ADO), manually.

    If i want add other ASP connection in site B, i have to configure connection string in the asp page ...

    I needed create another site, copy the C site, but, all connection in new copy, must point to another sql server...
    There is way of do this, without change each connection string in the pages of new copy site ?
    OBS.: I think that a feature called "Alias" of sql server, dont help me, beacause if i create a alias called Server1\C, then, the connection of site C also would change... but i want change only connection for new site, which copy of site c ( only pages will copied );

     

    Thanks.


    []s Rodrigo Ribeiro Gomes
    Monday, July 4, 2011 2:18 PM

Answers

  • THe global.asa dont help me...

    In little words: I needed way of "redirect" all database ADO connectinos of specific site in IIS...


    []s Rodrigo Ribeiro Gomes

    In that case you may get better reply posting your question at http://forums.iis.net
    • Marked as answer by RodrigoRRG Tuesday, July 5, 2011 2:43 PM
    Tuesday, July 5, 2011 2:08 PM

All replies

  • The connection strings used for connection with sql server is defined with .asp (ADO), manually.

    If i want add other ASP connection in site B, i have to configure connection string in the asp page ...

    I don't think you need to use Server Alias....

    Situation like this you should be using connection string within the global.asa (for classic asp 3.0) so that it is available across all the .asp page on the website.

    so you only need to change it at one place global.asa

    other option would be to have an include file dbconn.inc and include that file in all .asp pages so you need to change servername  only one place (dbconn.inc)

    Situation is not different for ASP.net in which you change connection string in web.config file.

     

     

    Monday, July 4, 2011 4:32 PM
  • Thanks Chirag Shah...

    Yes, i too not think that i to use Alias...

    The global.asa seem good option...

    The dbconn.inc option no worth because i will have change in many location, equals if i went change manually each page that contains a connection ...

    THe organization is follow:

    There is in each folder of application, a include file that contains the variable with connection string... This file is included on the pages of this own application that need connect to database ...

    Then, in this pages that includes the connection file, when is need connect to supply connection string to ADO, then we just put the variable name instead of connection string... So, if i need change the application database, or server, just change in included file... But i have many application, that not require change each connection string ... If exists the best approach with minum effort, i learn it... 

    Thanks... I go keep this question unanswered until i try with global.asa...

    While, i accept more suggestion...

    Very thanks again, Chirag Shah.

     


    []s Rodrigo Ribeiro Gomes
    Monday, July 4, 2011 5:11 PM
  • THe global.asa dont help me...

    In little words: I needed way of "redirect" all database ADO connectinos of specific site in IIS...


    []s Rodrigo Ribeiro Gomes
    • Edited by RodrigoRRG Tuesday, July 5, 2011 12:15 PM Worong information
    Tuesday, July 5, 2011 12:14 PM
  • THe global.asa dont help me...

    In little words: I needed way of "redirect" all database ADO connectinos of specific site in IIS...


    []s Rodrigo Ribeiro Gomes

    In that case you may get better reply posting your question at http://forums.iis.net
    • Marked as answer by RodrigoRRG Tuesday, July 5, 2011 2:43 PM
    Tuesday, July 5, 2011 2:08 PM