I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: 'PeopleManagement.Web.Views.Search.Search' is not allowed here because it does not extend class 'System.Web.UI.Page'.
Source Error:
Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Master.Master" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="PeopleManagement.Web.Views.Search.Search" %>
Line 2: <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
Line 3: </asp:Content>
This is the entire contents of my Code Behind for that aspx page:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace PeopleManagement.Web.Views.Search
{
public partial class Search : ViewPage
{
}
}
I'm not sure what changed in my app that is causing this. It seems like VS might be reading this as a webforms app instead of an MVC app maybe? Any ideas on where I should start to troubleshoot?