MvcContrib.FluentHtml.ModelWebViewPage and ASP.NET MVC4
-
03-03-2021 - |
Вопрос
Just trying to get work mvc4 with mvccontrib I set base page in web.config (the same way i did in my mvc3 projects)
<pages pageBaseType="MvcContrib.FluentHtml.ModelWebViewPage">
But in run time i get an error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0305: Using the generic type 'MvcContrib.FluentHtml.ModelWebViewPage<T>' requires 1 type arguments
Source Error:
Line 32:
Line 33:
Line 34: public class _Page_Views_Home_Index_cshtml : MvcContrib.FluentHtml.ModelWebViewPage {
Line 35:
Line 36: #line hidden
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\17698293\b6166ab6\App_Web_index.cshtml.a8d08dba.e7moq-gi.0.cs Line: 34
May be some one may help with that? Any thoughts?
UPDATE:
Looks like the problem is:
If i set custom base class <pages pageBaseType="MvcContrib.FluentHtml.ModelWebViewPage">
and if view does not have any custom model on it in such case i am getting that error. So in such case i just need to set model in the view to @model dynamic and it would work and than failed again, so i just change basePageType to its default and use MvcContrib.FluentHtml.ModelWebViewPage<dynamic> and MvcContrib.FluentHtml.ModelWebViewPage<MyModel>
until it will be fixed in the next MvcContrib/MVC 4
versions.
Решение
The issue is MvcContrib.FluentHtml.ModelWebViewPage
does not exist, there is only MvcContrib.FluentHtml.ModelWebViewPage<T>
. If you don't have a model class, you could do MvcContrib.FluentHtml.ModelWebViewPage<dynamic>
.
All that said, I have no idea of MVC Contrib will work with MVC4, typically one needs to at least recompile things against the new MVC version . . . .