12

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 this somewhere but my google skills are failing me at the moment.

jdelator
  • 4,101
  • 6
  • 39
  • 53

1 Answers1

21

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)

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900