Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Parser Error Cannot load code behind

Tags:

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.

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

Source Error:

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 {

Any Ideas ?

like image 679
StevieB Avatar asked Jun 02 '11 10:06

StevieB


1 Answers

Try changing CodeBehind:

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

To CodeFile:

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

ASP .NET 1.1 used CodeBehind for compiling code in a separate file. ASP .NET 2.0 introduced the CodeFile syntax for compilation of partial classes.

See here for a more detailed explanation.

like image 168
Phaedrus Avatar answered Sep 22 '22 07:09

Phaedrus