4

I am trying to implement a strongly typed master page and using this page as an example:

How to create a strongly typed master page using a base controller in ASP.NET MVC

I have the following declaration in my masterpage:

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage<InsTech.ForeSight.Web.Mvc.ModelBase>" %>

When I try to run I get: Parser Error Message: Could not load type 'System.Web.Mvc.ViewMasterPage<InsTech.ForeSight.Web.Mvc.ModelBase>'

I am not really sure why it can't find the type. When I use the ViewMasterPage class everything is okay, but when I try to use the generic version it bombs.

Any Suggestions

Community
  • 1
  • 1
Kevin
  • 1,141
  • 16
  • 27

2 Answers2

4

Is InsTech.ForeSight.Web.Mvc.ModelBase in another assembly? if so, is it referenced?

Is InsTech.ForeSight.Web.Mvc.ModelBase abstract?

ajma
  • 12,106
  • 12
  • 71
  • 90
  • New Day, Fresh Mind, Saw my stupid error. Thanks for your help – Kevin May 14 '09 at 16:16
  • 6
    I guess I should have explained my problem in case anyone finds this in the future. Since I was adding MVC to an existing web form project, I didn't realize that the default MVC template had a web.config in the views folder. This web.config defines some default values for the pages configuration section that MVC will need. – Kevin May 14 '09 at 23:53
  • @Whoiskb what exactly did you need to add? I'm facing the same problem, inheriting from ViewMasterPage works, but not ViewMasterPage. Added the Views\web.config from a MVC project. – Wiebe Tijsma Apr 01 '11 at 12:19
  • @Whoiskb, I am facing the same issue. Can you pls. suggest what did you do to make it work? Pls. see my question here: http://stackoverflow.com/questions/5952713/parser-error-for-strongly-typed-master-page-in-mvc-2 – Alex May 10 '11 at 17:23
0

I got this error when my MVC Master page was outside the 'Views' folder (with my normal Web forms master pages), moving it there solved this error for me.

Edit: Sorry I didn't see @Whoiskb already posted the same answer in the comments up there. Just leaving this answer for people who don't read all the comments :)

Wiebe Tijsma
  • 10,173
  • 5
  • 52
  • 68