maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
537 stars 220 forks source link

Migration path from BootstrapMenuHelperModel #467

Closed mwpowellhtx closed 6 years ago

mwpowellhtx commented 6 years ago

Hello,

It's been a little while for me since refreshing, and I was once using the BootstrapMenuHelperModel (good stuff, there, BTW). I can't imagine this functionality has vanished, however, the reference to this helper model seems to have vanished, or changed name?

@Html.MvcSiteMap().Menu("BootstrapMenuHelperModel", false)

Thanks!

mwpowellhtx commented 6 years ago

Actually, I should clarify, I am receiving an exception and I think I have any understanding as to why, but wanted to run it by someone.

I'm thinking this is because, perhaps rightly so, that the required Controllers are not there yet in order to support the sitemap that I've outlined. I'll stub them in with nominal requirements and see if that doesn't improve things, i.e. at least loading the site with the menu.

Exception:

System.ArgumentNullException was unhandled by user code
  HResult=-2147467261
  Message=Value cannot be null.
Parameter name: controller
  ParamName=controller
  Source=MvcSiteMapProvider
  StackTrace:
       at MvcSiteMapProvider.Web.Mvc.MvcContextFactory.CreateControllerContext(RequestContext requestContext, ControllerBase controller)
       at MvcSiteMapProvider.Security.AuthorizeAttributeAclModule.CreateControllerContext(ISiteMapNode node, RouteData routes, Type controllerType, IControllerFactory controllerFactory, Boolean& factoryBuiltController)
       at MvcSiteMapProvider.Security.AuthorizeAttributeAclModule.VerifyController(ISiteMapNode node, RouteData routes, Type controllerType)
       at MvcSiteMapProvider.Security.AuthorizeAttributeAclModule.VerifyNode(ISiteMap siteMap, ISiteMapNode node, HttpContextBase httpContext)
       at MvcSiteMapProvider.Security.AuthorizeAttributeAclModule.IsAccessibleToUser(ISiteMap siteMap, ISiteMapNode node)
       at MvcSiteMapProvider.Security.CompositeAclModule.IsAccessibleToUser(ISiteMap siteMap, ISiteMapNode node)
       at MvcSiteMapProvider.SiteMap.IsAccessibleToUser(ISiteMapNode node)
       at MvcSiteMapProvider.RequestCacheableSiteMap.IsAccessibleToUser(ISiteMapNode node)
       at MvcSiteMapProvider.SiteMapNodeSecurityBase.IsAccessibleToUser()
       at MvcSiteMapProvider.SiteMap.GetChildNodes(ISiteMapNode node)
       at MvcSiteMapProvider.SiteMapNodePositioningBase.get_ChildNodes()
       at MvcSiteMapProvider.SiteMapNodePositioningBase.get_HasChildNodes()
       at MvcSiteMapProvider.Web.Html.Models.SiteMapNodeModel.get_Children()
       at ASP.__mvcsitemapprovider_displaytemplates_menuhelpermodel_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in http://server/__MVCSITEMAPPROVIDER/DisplayTemplates/MenuHelperModel.ascx:line 8
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.UI.Control.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
       at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
       at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
       at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
       at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 
mwpowellhtx commented 6 years ago

Assuming that is the issue, it would be nice if there were more detail in the exception, such as which menus or desired Controllers/Actions were involved with the item.

mwpowellhtx commented 6 years ago

I see what happened. I pulled the Core package in instead of the top level MVC5. It's been a little while working with this, like I said; getting my radar attenuated.