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

Time:09-22

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.

CodePudding user response:

You can try to set the CPU to x64 in visual studio to slove this issue:

  1. On the menu bar, choose Build, Configuration Manager.

  2. In the Active solution platform list, choose a 64-bit platform for the solution to target, and then choose the Close button.

  3. If the platform that you want doesn’t appear in the Active solution platform list, choose New. The New Solution Platform dialog box appears.

  4. In the Type or select the new platform list, choose x64.

  5. If you want to copy the settings from a current platform configuration, choose it, and then choose the OK button.

enter image description here

If this does not solve your problem, you can also refer to the solution in this link:

Could not load type 'XXX.Global'.

CodePudding user response:

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.

  • Related