views:

3115

answers:

1

We've just updated ASP.NET from Preview 3 to Preview 5 and we've run into a problem with the Html.Image HtmlHelper in our aspx pages.

It seems that Html.Image has moved from System.Web.Mvc into Microsoft.Web.Mvc, and the only way we've found to access the helper now is to add an import statement to every .aspx page that uses it. All the other helpers can be accessed with using System.Web.Mvc; in the C# codebehind of a view master page, but this one seems to need an <@Import Namespace="Microsoft.Web.Mvc"> in every .aspx page.

Does anyone know of a way around this?

+8  A: 

You can add the namespace to pages in System.Web in you web config.

<pages validateRequest="false">
    <namespaces>
        <add namespace="Microsoft.Web.Mvc"/>     
    </namespaces>
</pages>
Paco
Perfect! Thank you :)
Sam Wessel