MvcSiteMapProvider in mixed webform/mvc3 application

Nov 23, 2011 at 10:56 AM

I spent some hours yesterday trying to make this dll work in a mixed application. It was an old webform website, that used the old sitemap provider, wthat i just migrated to aspnet4 and added mvc3 into.

MvcSiteMapProvider didn't work straight from Nuget...i had to change the webconfig, adding the new provider to the old webform one, and stting it as NOT default (ad I needed to be),

then I had to call the Helper passing the provider name (since it's not the default).

I thought it would have run...but still I god a strange problem during rendering:

“The view at '~/Views/Shared/DisplayTemplates/MenuHelperModel.ascx' must derive from ViewPage, ViewPage<TViewData>, ViewUserControl, or ViewUserControl<TViewData>”

Now, this problem usually occurs when there are two Mv assemblies referenced...but I didnt referenced two of them. only Mvc 3. What was it?

It was the Mvc dll, referencing both 2 and 3 version of Mvc (for compatibility puroposeds maybe?)

That's usually not a problem (I have it running on lot of Mvc sites) but it seems to be in the mixed application...

How to solve this? Just download the source code, delete the Mvc2 reference and compile your new DlLL. It worked for me.