ASP.NET分析器错误无法在后面加载代码 [英] ASP.NET Parser Error Cannot load code behind

查看:100
本文介绍了ASP.NET分析器错误无法在后面加载代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我收到以下错误消息

Hey I am getting the following error

解析器错误说明:在解析服务于此请求所需的资源期间发生错误.请查看以下特定的解析错误详细信息,并适当地修改您的源文件.

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.

解析器错误消息:无法加载类型'_AddToCart'.

Parser Error Message: Could not load type '_AddToCart'.

源错误:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="_AddToCart" Title="Untitled Page" %>
Line 2:  
Line 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


Source File: /FSAICart/AddToCart.aspx    Line: 1 

我在文件后面有匹配的代码,定义如下:

Where I do have the matching code behind file which is defined as follows

    using System;
  public partial class _AddToCart : System.Web.UI.Page {

有什么想法吗?

推荐答案

指定 Page 指令的 Inherits 属性的命名空间

Specify the namespace of the Inherits property of Page directive

查看页面后面的代码.看起来像:

Look at codebehind of your page. It looks like:

namespace MyWebSite
{
     public partial class _AddToCart : System.Web.UI.Page 
     {
        //...
     }           
}

因此您必须将 Page 指令更改为:

So you must change Page directive to:

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="AddToCart.aspx.cs" Inherits="MyWebSite._AddToCart" Title="Untitled Page" %>

这篇关于ASP.NET分析器错误无法在后面加载代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆