Tuesday, February 15, 2011

Parser Error Message: Could not load type 'System.Web.Mvc.ViewPage

                     Hi all,

                         Recently I have faced one of the exception in my Project .I have got this exception when I  integrated  my code with my colleague’s solution .I have taken different approaches to find the problem but no use .Finally I fixed the issue. The purpose of this post is  for anyone  else who might be experiencing this particular pain…

                       The problem is  “view engine has problems compiling strongly typed base class in Inherit attribute”  Check  your  project View folders web.config file having following references .If not add these and run the application .It works..

Remove below page section  if already in web.config

<pages>
      <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>


And add this  pages section in web.config .




 

<pages
     pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
     pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
     userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
       <controls>
            <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
       </controls>
</pages>

2 comments:

  1. This solution solved the initial error, but caused rendering partial views to fail.

    I included the following:









    and everyting worked fine.

    Using MVC 3.0 though.

    Thanks, this had me going for a while.

    ReplyDelete
  2. !!!YOU ARE THE MAN!!!

    ReplyDelete