System.Web.Mvc.HtmlHelper does not contain a definition for MvcSiteMap

user667430 picture user667430 · Mar 26, 2014 · Viewed 8k times · Source

I am using MvcSiteMapProvider MVC5 with my web application and inside of my _Layout.cshtml file I am using:

@if (Html.MvcSiteMap().SiteMap.CurrentNode != Html.MvcSiteMap().SiteMap.RootNode)
    {
        @Html.MvcSiteMap().SiteMapPath()
    }

But the Intellisence is throwing this error:

System.Web.Mvc.HtmlHelper does not contain a definition for MvcSiteMap

Does anyone know how to fix this problem?

Answer

user667430 picture user667430 · Mar 26, 2014
@using MvcSiteMapProvider.Web.Html

Fixed by adding this to the top of the view as said by

@StevenV