Using VS2008
I've been working with this (legacy) application for a year now, then last Friday, when trying to debug it, I get this 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 'FIPS._Default'.
Source Error:
Line 1: <%# Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="FIPS._Default" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I underdstand I could simply change "CodeBehind" to "CodeFile", I've read Could not load type 'site._Default', CodeFile vs CodeBehind and # Page
The problem is that we do use TSF and I am the only one with this situation, Why would I have to modify the whole project?
Please help me figure this out. What could have caused this error? How can I fix it?
EDIT
<%# Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FIPS.Web.Admin.Default" Title="FIPS" %>
That is supposed to be the guilty line, but the issue might not even be there; this project was working fine one day and then the next, kaputz! No changes have been applied to the code or computer, BUT automated updates out of my control might have been applied.
Related
I have a Master page which needs to inherit from a class (MasterPage2.cs) stored inside "App_Web_yht1mma2" folder.
In the master page, I have set the code as:
<%# Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>
When I debug this page, I receive 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 the assembly 'App_Web_yht1mma2'. Make sure that it is compiled before accessing the page.
Source Error:
Line 1: <%# Master Language="C#" AutoEventWireup="true" Inherits="MasterPage2,App_Web_yht1mma2" %>
Line 2:
Line 3:
Source File: /MasterPage.master Line: 1
Kindly advise me on how to correct this error.
Thank you for your help but I managed to figure it out through assistance from a friend.
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage2" %>
or
<%# Master Language="C#" AutoEventWireup="true" CodeBehind="MainMasterPageWeb.Master.cs"
Inherits="App_Web_yht1mma2.MasterPage2" %>
Both ways are possible solutions
I have searched through Stackoverflow, Google, and tried different configurations like CodeFile rather than CodeBehind. The error changes slightly but still get it, really stuck on this one. Any help will be appreciated. The exact error is below, my code for that error is below that.
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 'BestPricingEngine.Main'.
Source Error:
Line 1: <%# Page Title="Import FBA Orders" Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPages/MasterPage.Master" CodeBehind="ImportFBAOrders.cs" Inherits="BestPricingEngine.Main" %>
Line 2: <%# Register src="ImportFBAOrders.ascx" tagname="ImportFBAOrders" tagprefix="ucImportFBAOrders"%>
Line 3:
Source File: /Pages/ImportFBAOrders/ImportFBAOrders.aspx Line: 1
<%# Page Title="Import FBA Orders" Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterPages/MasterPage.Master" CodeBehind="ImportFBAOrders.cs" Inherits="BestPricingEngine.Main" %>
<%# Register src="ImportFBAOrders.ascx" tagname="ImportFBAOrders" tagprefix="ucImportFBAOrders"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpSidebar" Runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpMainContent" runat="server">
<ucImportFBAOrders:ImportFBAOrders ID="importFBAOrders" runat="server" />
</asp:Content>
There should not be a period in your BestPricingEngine.Main. The Inherits attribute is normally used in the markup to reference the code-behind of that page.
In other words, looking at this code, I would assume your Inherits attribute should be named after that page's class, which is usually the path of the code-behind file delimited by underscores, and excluding the file extension.
EDIT
Change Inherits="BestPricingEngine.Main" to Inherits="BestPricingEngine.Pages"
I have a website (asp.net 4) with 49 pages. The website is in vb.
But I added a forum (and called it "knowledgbase"), so it's like ... company.com/knowledgebase/ ... I configured the forum as a separate application in IIS7, and it's written in c#.
Is it possible to use one of my vb master pages in the c# forum? Or would I have to create an entirely separate c# master page?
Edit:
Basically, in the knowledgebase/default.aspx file, there's this:
<%# Page Language="C#" AutoEventWireup="true" ValidateRequest="false"
Inherits="YAF.ForumPageBase" culture="auto" uiculture="auto" %>
<%# Register TagPrefix="YAF" Assembly="YAF" Namespace="YAF" %>
<script runat="server">
I tried doing this:
<%# Page Language="C#" AutoEventWireup="true" ValidateRequest="false"
Inherits="YAF.ForumPageBase" culture="auto" uiculture="auto"
MasterPageFile="~/homepage.Master" %>
<%# Register TagPrefix="YAF" Assembly="YAF" Namespace="YAF" %>
<script runat="server">
But of course ... the page language says "c#" and the master page is written in vb. So the result was this (as expected):
Server Error in '/knowledgebase' 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: The 'masterpagefile' attribute is not supported by the
'register' directive.
I have been doing this for hours and it keep coming out the same error. I don't know why ! I managed to create the first webform for masterpage. Somehow , subsequence webforms are getting the same error.
This is the webform i had created:
<%# 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>
When i want to view it in browser:
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#" %>
Update: This is a ASP.Net Web Application Project.
Code-behind of WebForm3:
namespace mainWebsite_EID_Shop_
{
public partial class WebForm3 : Page
{
}
}
Can anyone explain why sometime the web form works and sometime it doesn't works.
Update2: More errors:
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">;
Your Global.asax should look like the following:
<%# Application Inherits="mainWebsite_EID_Shop_.Global" %>
and Global.asax.cs:
namespace mainWebsite_EID_Shop_
{
public class Global
{
}
}
Short story.
This site was created by a friend of mine, who did not know that much C# or asp. And was firstly created in VS 2k3. When i converted it to VS 2k8 these errors started to crop up, there was also other issues with compiling that i managed to sort out ( Seemed to be released to VS 2k8 wanted design files )
Error message gotten:
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: The file '/TestSite/Default.aspx.cs' does not exist.
Source Error:
Line 1: <%# Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="GuildStats._Default" %>
Line 2:
Line 3: <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
Defaults.aspx.cs
namespace GuildStats
{
public partial class _Default : System.Web.UI.Page
{
Defaults.aspx
<%# Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="GuildStats._Default" %>
Site.master.cs
namespace GuildStats
{
public partial class Site : System.Web.UI.MasterPage { }
}
Site.master
<%# Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="GuildStats.Site" %>
In Default.aspx change CodeFile to CodeBehind. You'll probably have to do the same for the Site.master.
See: CodeFile and Code-Behind
Web Site projects use CodeFile, Web Application projects use CodeBehind.
CodeFile requires the source file, it is compiled on the fly when the page is loaded, CodeBehind requires the compiled code.
My guess is that your problem was created when you changed your project type from a WebApp to a Web Site or vice-versa. If you do this, you have to manually change the directives in the existing files, new files will have the right directive automatically.