Can I place system.web.webPages.razor in my top level web.config when using scopes?

I use MVC scopes. Inside each area, I have a views section and in this web config that contains the following:

<configSections> <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> </sectionGroup> </configSections> <system.web.webPages.razor> <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <pages pageBaseType="System.Web.Mvc.WebViewPage"> <namespaces> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> ... more namespaces common to all views ... </namespaces> </pages> </system.web.webPages.razor> 

I always try not to repeat my code, so I'm curious. Can I take the above from web.configs in each area and add to the top level web.config. I tried and it seems to work. But is it good to do this?

+4
source share
1 answer

Yes, you can.

However, your site will be broken any pages that are not related to MVC Razor.

+2
source

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


All Articles