asp.net - ~/Views/Web.config and its content -
i'm creating website since zero, , i've used mvc pattern.
~/web.config has assembly references dlls, has ~/views/web.config? yes, file block access controllers , more., file adding namespaces (and more things), example. why necessary?
<?xml version="1.0"?> <configuration> <configsections> <sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> <section name="host" type="system.web.webpages.razor.configuration.hostsection, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor, version=3.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=5.2.2.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.optimization"/> <add namespace="system.web.routing" /> <add namespace="webapplication4" /> </namespaces> </pages> </system.web.webpages.razor> <appsettings> <add key="webpages:enabled" value="false" /> </appsettings> <system.webserver> <handlers> <remove name="blockviewhandler"/> <add name="blockviewhandler" path="*" verb="*" precondition="integratedmode" type="system.web.httpnotfoundhandler" /> </handlers> </system.webserver> </configuration>
it sets base page type:
<pages pagebasetype="system.web.mvc.webviewpage">
without above line have set on each view this:
@inherits system.web.mvc.webviewpage
webviewpage has properties html
, url
integrate mvc razor.