Using default namespaces in .NET MVC for views without using import?

前端 未结 1 655
遇见更好的自我
遇见更好的自我 2021-01-17 13:10

How do you configure the views to able to reference a namespace like System.Web.Mvc without having to do <%@ Import Namespace=\"System.Web.Mvc\" %>? I remember seeing thi

相关标签:
1条回答
  • 2021-01-17 13:48

    Can you add them in web.config? Don't know if this works in MVC, though...

    <configuration>
     <system.web>
        <pages>
          <namespaces>
            <add namespace="Foo.Blop" />
            <add namespace="Bar.Whatever"/>
          </namespaces>
        </pages>  
     </system.web>
    </configuration>
    

    (update - seems to work fine ;-p)

    0 讨论(0)
提交回复
热议问题