I have inherited a hybrid MVC / Webforms project, the MVC portion uses MVCSiteMapProvider to create the menus and the WebForm portion uses a custom built menu creation tool.
I have just created some custom MVCSiteMapProvider nodes and would like to port the whole MVCSiteMapProvider to be used in the webform portion of the project. Is this possible at all? Can anyone suggest any strategies for wedging/hacking it in to the webform code?
thanks Andy
Although in theory we should have working interoperability with WebForms, to my knowledge it hasn't been tried or even tested. But then, if there were no issues with setting it up, I probably wouldn't have heard about it.
To set it up:
url
attribute instead of configuringcontroller
,action
, etc.That is basically all of the functionality that the default ASP.NET sitemap providers have, so you wouldn't have access to visibility providers, dynamic node providers, or some of the other more advanced features of MvcSiteMapProvider when working within WebForms unless you build your own
System.Web.SiteMapProvider
that can handle those details.Since none of the HTML helpers post back, you might also be able to get away with just writing the output of the Menu and SiteMapPath HTML helpers in the WebForm, although I am skeptical this will work because the HTML helpers are templated, which probably means they only work in MVC views. Building your own HTML helpers that output HTML or even output ASP.NET controls is also potentially possible because they are simply extension methods that can be called from WebForms.
Please provide any feedback by opening a new issue @ GitHub.