HttpParseException in SiteMapPathHelperModel.ascx in 2.2

Oct 27, 2010 at 7:24 PM

I just installed the new version 2.2.  I've put the default DisplayTemplates into a DisplayTemplates folder underneath my Views folder, and I've registered the provider using the default settings in web.config.  When I try to display a SiteMapPath (using Html.MvcSiteMap().SiteMapPath()), I get the following error on the "Html.DisplayFor(m => node) line of SiteMapPathHelperModel.ascx: HttpParseException "Could not load type 'System.Web.Mvc.ViewUserControl<MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModel>'".  Intellisense in Visual Studio recognizes the type, so it seems to be something happening at runtime (I'm using VS2010).  Thanks.

Oct 27, 2010 at 7:54 PM

Very strange, I was able to resolve this by changing the <pages> declaration in the top-level Web.config to match the one that is in the Views folder.  i.e.

<pages
         validateRequest="false"
         pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
         pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
         userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="MvcSiteMapProvider.Web.Html" />
      </namespaces>
    </pages>

 

Oct 28, 2010 at 2:13 AM

I have the same problem and I have modified the Web.Config like you did but the problem is still occurs.

   <pages
        validateRequest="false"
        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>

Should I do anything else?

 

Thank you

Coordinator
Oct 28, 2010 at 6:46 AM

This has been fixed in the release, I suggest re-downloading it.

Another option is changing the SiteMapNodeModel.ascx to: (I marked the change on the first line in red)

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl`1[ [MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModel,MvcSiteMapProvider] ]" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>

<% if (Model.IsCurrentNode && Model.SourceMetadata["HtmlHelper"].ToString() != "MvcSiteMapProvider.Web.Html.MenuHelper")  { %>
    <%=Model.Title %>
<% } else if (Model.IsClickable) { %>
    <a href="<%=Model.Url %>"><%=Model.Title %></a>
<% } else { %>
    <%=Model.Title %>
<% } %>

Oct 28, 2010 at 2:06 PM

I made this change (and removed the web.config change I made yesterday) and it is back to erroring again.  Same error "Could not load type 'System.Web.Mvc.ViewUserControl<MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModel>'.  When I put the web.config change back in, it started working again.

Coordinator
Oct 28, 2010 at 2:36 PM

I'll dig into this one...

Coordinator
Oct 28, 2010 at 2:36 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.