“System.Web.Mvc.ViewMasterPage” Parser Error

I’m currently working on my first ASP.NET MVC app, code name Biscuit. I edited some Master Pages today and upon starting my app received the following parser error:

The type ‘System.Web.Mvc.ViewMasterPage’ is ambiguous: it could come from assembly ‘C:\Windows\assembly\GAC_MSIL\System.Web.Mvc\\System.Web.Mvc.dll’…

Turns out one of my new Master Pages had .cs and .designer.cs files attached.

As explained in this ASP.NET forum post, the namespace for my .designer.cs file has been changed to: System.Web.Mvc, which is why the site got confused.

The solution for it going forward:

Subscribe to comments Comment | Trackback |
Post Tags: , , ,

Browse Timeline

Comments ( 7 )


“System.Web.Mvc.ViewMasterPage” Parser Error | Alpha Papa Hotel…

uab.cat added these pithy words on Jun 28 14 at 10:43 pm

Thanks for the solution. However I am a bit confused.

When you say “Change the inherits attribute in the HTML file to your namespace and class name.”

I’m new to ASP.NET MVC.

My Site.Master file currently reads:

What should it say instead? Thanks.

James added these pithy words on Jan 18 10 at 9:04 pm

Sorry it seems as if some of my post got parsed out.

My Site.Master file currently reads:


What should be there instead? Thanks.

James added these pithy words on Jan 18 10 at 9:05 pm

Hi James, that should work fine for your Site.master.

In your .aspx file that references Site.Master you’ll want to change the “Inherits” attribute.

For example, in my root directory I have a .aspx file called “Default.aspx” and its code-behind file called “Default.aspx.cs”.

In Default.aspx:

Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Biscuit._Default"

In Default.aspx.cs:

using System.Web;
using System.Web.Mvc;
using System.Web.UI;

namespace Biscuit
public partial class _Default : Page
public void Page_Load(object sender, System.EventArgs e)
// Change the current path so that the Routing handler can correctly interpret
// the request, then restore the original path so that the OutputCache module
// can correctly process the response (if caching is enabled).

string originalPath = Request.Path;
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
IHttpHandler httpHandler = new MvcHttpHandler();
HttpContext.Current.RewritePath(originalPath, false);

I hope this helps!

Ann added these pithy words on Jan 19 10 at 4:59 pm

If you’re using Visual Studio, be sure to add a ViewMaaterPage and not a masterpage. You shouldn’t need the code behind and designer file for an ASP.NET MVC master page. :)

hope that helps.

Haacked added these pithy words on Jan 21 10 at 10:17 pm

Hello i am kavin, its my first occasion to commenting anywhere,
when i read this article i thought i could also make comment due to this sensible post.

book moscow hotel added these pithy words on Jan 23 13 at 11:13 pm

Quality posts is the key to be a focus for the users to go
to see the web page, that’s what this web page is providing.

great site added these pithy words on May 29 13 at 4:41 pm

Add a Comment

You must be logged in to post a comment.

© Copyright 2009-2010 Alpha Papa Hotel . Thanks for visiting!