Background Knowledge
My web application ran fine locally but then experienced the “Prase Error Could Not Load Type” error message when I copied the files to the web server. In my case I was producing a web application using Visual Studio 2005 and coding in C#.NET.
Example of Error Message
Server Error in ‘/CustomErrorPages’ 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 ‘CustomErrorPages.WebForm1′.
Source Error:
Line 1: < %@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="CustomErrorPages.WebForm1" %>
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: /CustomErrorPages/WebForm1.aspx Line: 1
Solutions
- Make sure you compiled your project.
- Make sure your bin folder is in the correct location with the DLL, in this example case “/bin/WebForm1.dll”.
- Make sure that you created a virtual directory or application root for your project.
- Make sure you have the correct .NET Framework set in IIS that is required for the application.
- Make sure you copied all the required application files.