使用母版页创建Web表单

时间:2012-06-22 16:22:57

标签: c# asp.net .net exception-handling master-pages

我已经这样做了几个小时并且它一直出现同样的错误。我不知道为什么!我设法为masterpage创建了第一个webform。不知何故,子序列webforms得到了同样的错误。

这是我创建的网络表单:

<%@ Page Title="" Language="C#" MasterPageFile="~/EIDShopMain.Master" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="mainWebsite_EID_Shop_.WebForm3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>

当我想在浏览器中查看时:

Server Error in '/' Application.
Parser Error  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: Could not load type 'mainWebsite_EID_Shop_.Global'.
Source Error: 
Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="mainWebsite_EID_Shop_.Global" Language="C#" %>

更新:这是一个ASP.Net Web应用程序项目。

WebForm3的代码隐藏:

namespace mainWebsite_EID_Shop_
{
    public partial class WebForm3 : Page
    {
    }
}

任何人都可以解释为什么Web表单有效,有时它不起作用。

更新2:更多错误:

Parser Error 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: Could not load type 'mainWebsite_EID_Shop_.EIDShopMain'.
Source Error:
Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="EIDShopMain.master.cs" Inherits="mainWebsite_EID_Shop_.EIDShopMain" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">;

1 个答案:

答案 0 :(得分:0)

您的Global.asax应如下所示:

<%@ Application Inherits="mainWebsite_EID_Shop_.Global" %>

和Global.asax.cs:

namespace mainWebsite_EID_Shop_
{
    public class Global
    {
    }
}