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.
2
Answers
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
withCodeFile
. (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
topublic 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.
You can try to set the CPU to x64 in visual studio to slove this issue:
On the menu bar, choose Build, Configuration Manager.
In the Active solution platform list, choose a 64-bit platform for the solution to target, and then choose the Close button.
If the platform that you want doesn’t appear in the Active solution platform list, choose New. The New Solution Platform dialog box appears.
In the Type or select the new platform list, choose x64.
If you want to copy the settings from a current platform configuration, choose it, and then choose the OK button.
If this does not solve your problem, you can also refer to the solution in this link:
Could not load type 'XXX.Global'.