Parser Error Message: 'FCR2.abs' is not allowed here because it does not extend class 'System.Web.UI.Page'
Does anyone have any idea how to solve this problem please?
This is the Parser Error When I Run the Application:
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: 'FCR2.abs' is not allowed here because it does not extend class 'System.Web.UI.Page'.
Source Error:
Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="404.aspx.cs" Inherits="FCR2.abs" %>
Line 2: <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
Line 3: </asp:Content>
Source File: /404.aspx Line: 1 `enter code here`
This is my 404.aspx file:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="404.aspx.cs" Inherits="FCR2.abs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Page Not Found</h1>
<p>You have come here by mistake or the page you are trying to view is no longer availible.</p>
<p>Go back to the <a href="Default.aspx">Home Page</a></p>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
This is the 404.aspx.cs code:
namespace FCR2
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
This is the 404.aspx.designer.cs code:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//---------------------------------------开发者_JAVA百科---------------------------------------
namespace FCR2 {
public partial class abs {
}
}
Make sure you are using the same class names for that part of your code.
If you are using abs, you need to rename this like that:
namespace FCR2
{
public partial class abs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e) {
}
}
}
Not sure as what you are trying over here
public partial class abs {
}
This is defined as partial class and is not inhesriting for Page (as it happens for WebForm1
)
and your inherits points out to Inherits="FCR2.abs"
which i believe should be WebForm1
instead of abs
Try right click Convert to Web Application
and that should generate the proper designer file for you
精彩评论