Parser Error Message: Could Not Load Type

You may receive the error

Parser Error Message: Could not load type ‘WebApplication1.Global’.
Source Error: Line 1: <%@ Application Codebehind=”Global.asax.cs” Inherits=”‘WebApplication1.Global'” %>

when browsing an asp.net page.

This error occurs when you create a new web application in asp.net using visual studio.net and without compiling the application, you try to browse a page in the application. This occurs because of the Application DLL not having been formed.

asp.net will look in the Global Assembly Cache, and then in the application’s local bin directory. If it can’t find the class with the name you specified then it won’t load. When you do a codebehind file in Visual studio, you are writing a base class for your aspx file to inherit from – the HTML template you write in the aspx is inlined into the dynamically generated subclass’s Render method.

Even if you don’t put any code in your page, you still need to compile it as long as you put the Inherts Webappname.Global in your Page directive.

To resolve this, (re)build the application and then try to browse the application. The error will be resolved.

Advertisements

%d bloggers like this: