Parse Error ViewMasterPage<TModel>

ぃ、小莉子 提交于 2019-12-23 12:45:53

问题


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


回答1:


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

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




回答2:


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 :)



来源:https://stackoverflow.com/questions/860412/parse-error-viewmasterpagetmodel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!