开发者

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

In the web project, there开发者_StackOverflow社区 is one for the main folder, and then there is also one for the views.

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


Its not mandatory to have 2 web.config files. The one in the root of the site is the actual main web.config and 2nd one which is inside the folder specifies the configuration for the sub-section.

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

in the above example the sub configuration(web.config) contains the configuration of the url mapping inside Products, where as the Main we.config has the configuration of the over all structure.

There are more complex seniarios where same url directories are use in the root and in a sub section, this can easily be resolved by the second web.config

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜