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

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

And add this  pages section in web.config .


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