Parser error message: "FCR2.abs" is not allowed here because it does not extend the class "System.Web.UI.Page"

Does anyone know how to solve this problem?

This is the Parser error when starting 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> //------------------------------------------------------------------------------ namespace FCR2 { public partial class abs { } } 
+4
source share
2 answers

Make sure you use the same class names for this part of your code.

If you are using abs, you need to rename this as follows:

 namespace FCR2 { public partial class abs : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } } 
+1
source

Not sure how you are trying here

 public partial class abs { } 

This is defined as a partial class and is not written to the page (as happens with WebForm1 )

and your inheritance points to Inherits="FCR2.abs" , which I believe should be WebForm1 instead of abs

Try right-clicking Convert to Web Application , and for this you need to create the correct designer file

0
source

All Articles