When an .aspx page of ASP.NET 2.0 Web Application is viewed, at times we get the error "Could not load type xxxx'. The sample error message displayed is as follows
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 'xxxxxxx.Web.UI.Admin.Test'.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="xxx.Web.UI.Admin.Test" %> |
Source File: /Test.aspx Line: 1
There are several reasons why we get the error. We will present you the major reasons why we get the error and also how to correct them
Reason 1: Invalid Build Output Directory
If the build output folder of the web application is set to any folder other than Bin\, you would get this error. For example pointing the build output folder to ..\CommonBin\ or C:\Bin is not a valid configuration and this invalid configuration causes the Could not load type error.
To solve the error always point your output folder of the web application project to \bin
Reason 2: Referring to Code Behind Modules Without Building The Application
If you refer to any code behind module in .aspx pages or Global.asax page and the web application has'nt been built then you get this error.
To solve the error, build the web application using Build option(Ctrl+Shift+B) available in Visual Studio.NET development environment or use command line compilers like CSC.
Refer to Microsoft support page for elaborated information
Reason 3: Incorrect asp.net version configuration in IIS
Incorrect asp.net version configuration in IIS server also causes this error. For example, if you are using Visual Studio 2005 with an IIS configured with ASP.NET v1.1 is an invalid configuration.
In order to solve the problem follow these simple steps
- Go to Start Menu, click on Run (alternatively use Win Key + R )
- Type INetMgr and press enter to open Internet Information Services Application
- Expand the tree node displaying local computer name and navigate to Web Sites-->Default Web Site
- Right click on Default Web Site node and select the popup menu option Properties
- Navigate to ASP.NET tab in the properties page and set the version to 2.xxxx(for Visual Studio 2005) or 1.xxxx(for Visual Studio 2003)
No comments:
Post a Comment