Is it possible to use the ‘using’ statement in my aspx views? (ASP.NET MVC)

Do you mean like

<%@ Import namespace="MyProgram.MyNamespace" %>

Also, inside the root <configuration> tag of web.config, you can add:

<system.web>    
    <pages>
       <namespaces>
          <add namespace="System" />
          <add namespace="System.Collections" />
          <add namespace="System.Collections.Specialized" />
          <add namespace="System.Configuration" />
          <add namespace="System.Text" />
          <!-- etc -->
       </namespaces>
    </pages>
</system.web>

Leave a Comment