I have developed an ASP.net web application which interacts with sqlserver database. For database related task like ADO.net. Connection string gets loaded from web.config file. connection string loading code is written below
public DataBaseCache()
{
CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
//etc
}
My web.config file is below
<connectionStrings>
<add name="DBCS"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=F:\ProjectApplication6-3\ProjectApplication\App_Data\ProjectDatabases.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Now Problem is that if i save my Visual studio project file to other drive i need to change my connection string in web.config file in this example it is in Drive F. Please guide me how to avoid this copy paste each time i save application to various drives and code does it automatically.? regards