views:

493

answers:

4

When I am running my ASP.NET application I will get an error

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 'WebApp1._Default'.

Source Error:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApp1._Default" %> Line 2:
Line 3:

Source File: /Default.aspx Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

How can I solve this problem?

+1  A: 

Did you rename the namespace or class name in the code-behind file? Open the code-behind file and verify that the namespace for the page is called WebApp1 and that the class is called _Default, or update the Inherits-attribute in the aspx page header to fit the code-behind.

Fredrik Mörk
A: 

have you set your web app directory as application in IIS?

I have seen this error many times for different reasons.

  1. Check namespace
  2. dependent dll versions
  3. Visual studio clean and compile again.
  4. clean temp asp.net files "Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files"
Saar
I am not hosting in IIS.
Sauron
A: 

Check your DLL is in the bin folder. (Not bin/debug...).

Bravax
This is my problem. I change my output path. Why this happen so?
Sauron
It's by design, so visual studio allows you to compile different types of DLL. Release/Debug etc. It's something to be aware of really.
Bravax
A: 

Have you specified your _Default class is under the namespace WebApp1 in Default.aspx.cs file ?

Please check.

Himadri