G
Guest
Hello everyone,
I have a newbie question that I am sure you have probably encountered.
I am developing a ASP NET app that interfaces to a database ( SqlServer).
When I am developing I use my local version of MSSQL - so the connection string has something like:
connectionString="Data Source=myLocalMachine;Initial Catalog=my_db;Persist Security Info=True;User ID=...etc"
But when the app is released, I have to change "myLocalMachine" to the live or released database server "bigBusinessSqlServer392".
How can I manage my Web.config files so that I don't have to manually change each and every connection string on each release cycle?
If I was programming in C/C++, I could just have a string literal with a #define and/or compiler directive.
#ifdef _DEVELOPMENT
string dbserver = "myLocalMachine";
#else
string dbserver = "bigBusinessSqlServer392"
#endif
Is there an elegant / easy way to do this in ASP NET with web.config?
Thanks in advance.
bruce
I have a newbie question that I am sure you have probably encountered.
I am developing a ASP NET app that interfaces to a database ( SqlServer).
When I am developing I use my local version of MSSQL - so the connection string has something like:
connectionString="Data Source=myLocalMachine;Initial Catalog=my_db;Persist Security Info=True;User ID=...etc"
But when the app is released, I have to change "myLocalMachine" to the live or released database server "bigBusinessSqlServer392".
How can I manage my Web.config files so that I don't have to manually change each and every connection string on each release cycle?
If I was programming in C/C++, I could just have a string literal with a #define and/or compiler directive.
#ifdef _DEVELOPMENT
string dbserver = "myLocalMachine";
#else
string dbserver = "bigBusinessSqlServer392"
#endif
Is there an elegant / easy way to do this in ASP NET with web.config?
Thanks in advance.
bruce