I will always store the connection string in web.config, as the connections between servers and databases can always change, even if they are not shared. To make it easier to view in code, you can always add something like this:
String m_Connection = ConfigurationManager.AppSettings["MyConnectionString"];
and then just link m_Connectioneverywhere.
I would also always encrypt the connection string using EncryptionProvider.
Great MSDN Article: How to: Encrypt Configuration Sections in ASP.NET 2.0 Using DPAPI
source
share