2011-08-08 5 views
4

この問題を解決する方法はありますか?パーサーエラーメッセージ: 'FCR2.abs'は、 'System.Web.UI.Page'クラスを拡張しないため、ここでは許可されていません

私はアプリケーションを実行するとこれは、パーサーエラーです:

:これは404.aspx.csコードです

<%@ 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; 

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` 

これは私の404.aspxファイルです

namespace FCR2 
{ 
    public partial class WebForm1 : System.Web.UI.Page 
    { 
     protected void Page_Load(object sender, EventArgs e) 
     { 

     } 
    } 
} 

これは404.aspx.designer.csコードです。

あなたがここに

public partial class abs { 
    } 

を経由しようとしているもの。これは、部分クラスとして定義され、

を(それがWebForm1ために起こるように)とあなたの継承がに指摘したページのinhesritingされていないよう

//------------------------------------------------------------------------------ 
// <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 { 
    } 
} 

答えて

1

コードのその部分に同じクラス名を使用していることを確認してください。

あなたが腹筋を使用している場合は、そのように、この名前を変更する必要があります。

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

わかりません私が代わりにabs

WebForm1べきであると信じてInherits="FCR2.abs"は、右クリックConvert to Web Applicationを試してみて、それがヨーヨーのための適切なデザイナーのファイルを生成する必要がありますu

+0

みんなありがとう。私はどんな評判も持っていないので、投票を行うことはできません:) – mikespiteri

関連する問題