R – Best way to manage connection strings in a project containing both Classic ASP and ASP.Net 1.1 code

asp-classicasp.netconnection-string

I have a project that I have inherited that is primarily a Classic ASP application; however, intermixed in the the application are a handful of ASP.net pages. Some of the ASP.net pages are 1.1 and do not use a code behind model.

The classic ASP pages have a number of /include directories where there's a file for database connections. The ASP.Net pages have the connection string hard coded in in their code.

I'm trying to clean up this mess of connection strings so it's easier to manage across development environments.

Does anyone have any recommendations on how I may be able to effectively do this that will work for both Classic ASP and ASP.Net pages?

Thanks

Best Answer

Put a web.config file at the root of the asp classic site. ASP.net pages with no code behind (and assuming no virtual directories/applications anywhere) will use that web.config file. You can put connection strings in there. You will likely end up having two sets of strings, but that's better than many more. And if you really want to, you can write some asp classic code to read that config file.

Related Topic