Reputation: 37
i've create an asp dot net application. i try to deploy it using a Web Setup Project. but when i istall it i get this 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 'WebApplication2._Default'.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
what's the wrong here ?? how can i solve it. some probleme when i creat a new umpty application.!!!!
namespace WebApplication2 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } }
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %
I haven't change the name i let evry thing by default but it dosen't work??
Upvotes: 1
Views: 2559
Reputation: 2801
You get this error message when the assemblies linked to the application do not contain the _Default class. This is caused by the codebehind file having errors that prevent it compiling.
Also make sure that you are including the primary output
in your setup project.
Upvotes: 0
Reputation: 20617
Your files should look like this below, also make sure your output folder you deploy to is clean. If you deployed before with a different namespace...etc you could have old dlls and or .aspx files lingering.
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="WebApplication2._Default" %>
Default.aspx.cs:
namespace WebApplication2
{
public partial class _Default : System.Web.UI.Page
{
//...
}
}
Upvotes: 0
Reputation: 28701
Did you change the name of your code behind class for Default.aspx.cs? If so, that doesn't get automatically reflected in your Default.aspx file. You have to change that manually.
Just a guess - but that's where I'd look first.
EDIT (some add'l info): I just tested it out, and if I change the class name in Default.aspx.cs AND Default.aspx.designer.cs, I get the error in the original question. (Thanks for the comment!!) I think that's the problem.
I can have this happen also if I rename the code behind class and use the refactor option to change 'Default' to 'FooBar', for example. It renames the code behind and designer, but doesn't update the aspx page. I'm using VS2008.
So change your aspx page's Inherit's attribute from _Default to your new class name.
Upvotes: 3