In asp.net MVC 2.0, why are there two web.configs?

In a web project, there is one for the main folder, and then there is one for the views.

Both look the same. Why do we need two web.config?

+4
source share
1 answer

It is not necessary to have 2 web.config files. The one located at the root of the site is the actual main web.config and the second, which is inside the folder, indicates the configuration for this subkey.

[ROOT] Home Products Type Cost Make Web.Config <==== Sub configuration Portfolio About Us Web.config <==== Main web.config 

in the above example, the helper configuration (web.config) contains the url mapping configuration inside Products, where, since Main we.config has a configuration across the whole structure.

There are more complex seniarios where the same url directories are used in the root and in the subsection, this can be easily resolved using the second web.config

+5
source

Source: https://habr.com/ru/post/1338515/


All Articles