Why do I get 'Could not load type <namespace>.Global'?
The Global.asax file is a standard ASP.NET application class file (non MM .NET). The usual reason you get this error is because the namespace of your Global application class has been changed. To see if this has happened, do the following:
- In the Visual Studio Solution Explorer, right-click Global.asax and select Open With... from the shortcut menu. In the Open With dialog, select HTML/XML Editor, and then click Open. You should see something like this:
<%@ Application Codebehind="Global.asax.cs" Inherits="Acme.WebOrderSystem.Main.Global" %>
- The Codebehind attribute specifies the code-behind file associated with your global application class. The Inherits attribute specifies the fully qualified name of the class your global application object is derived from.
- Go back to the Solution Explorer, and see if the Global.asax file has a plus sign next to it. If it doesn't, go to the top of the Solution Explorer and click the Show All Files button. Expand the plus sign next to Global.asax.
- Double-click the Global.asax.cs or Global.asax.vb file. Make sure the namespace of the Global class is the same as that specified in the HTML element in step 1.
For example:
namespace Acme.WebOrderSystem.Main { /// <summary> /// Summary description for Global. /// </summary> public class Global : System.Web.HttpApplication { } }If it's different, either change the HTML element or the namespace declaration in the code-behind file.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 09/23/09
Comment or report problem with topic
