Search code examples
asp.netiisglobal-asax

Parser Error Message: Could not load type 'xxxx.Global'


Everything worked yesterday without any errors. Today though, I created a new page and tried to load it, which returned an error. so I went and rebuilt the solution, and now I have this error on every page on my site.

error description:

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 'xxxx.Global'.

Source Error:

Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="xxxx.Global" Language="C#" %>

Source File: /global.asax Line: 1

I tried to look up the error, but the solutions I managed to find didn't solve the problem, I would love some help as I am truly lost about what had caused this.


EDIT: so I tried deleting the Global.asax file and running the site, which caused the first line in all my pages to return an error messege. still trying to find a solution.


Solution

  • Managed to solve it, Here's what finally worked for me -

    first, in the first line of your aspx pages, Masterpage.Master and Global.asax you'll need to replace CodeBehind with CodeFile. (in order to access your Global.asax code open it through the directory with a text editor).

    after that, in your Global.asax.cs code, change public class Global : System.Web.HttpApplication to public partial class Global : System.Web.HttpApplication.

    worth noting - this is a mishmash of a number of solutions that I found while googling, trying these separately first could also solve the bug.