I have a solution composed of a web application and multiple projects, is it possible to share the configuration in the web application across all the solution?
Thanks
I attended one interview at that time they asked one question that is it possible to use multiple web.config files in single asp.net application? For that question answer is Yes we can use multiple web.config files in single web application but how?
Well, I think it is very common scenario where a single Application Configuration File (app.config) or Web Configuration File (web.config) needed to be used to multiple projects on the same solution. Hence I thought of putting it as tip for you. Lets see how to do this in steps.
The web.config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS. web.config file location In order to set up the ASP.NET Core Module correctly, the web.config file must be present at the content root path (typically the app base path) of the deployed app.
The web.config is a file that is read by IIS and the ASP.NET Core Module to configure an app hosted with IIS. In order to set up the ASP.NET Core Module correctly, the web.config file must be present at the content root path (typically the app base path) of the deployed app.
I looks like it is possible, you can try following:
You can copy your web.config
file to the root folder of your solution. Then create solution folder (which does not belong to any of your projects) and add your file there (via Add Existing Item
popup menu item). Delete web configs from your web sites. After that you can select Add Existing Item
from popup menu on your both web projects, select your web.config file from the solution root and click Add As Link
. After that you will have links to your web config files instead of real ones in your solution.
On the other hand I'm not sure if sharing of the web.config files among different projects is a good idea, because usually web.config has some specific condifuration for each separate application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With