PRB: "Could not load type" error message when you browse to .aspx page by using Visual C# .NET
This article was previously published under Q306155
When you browse to an .aspx page, you may receive one of the following error messages:
Could not load type 'Namespace.Global'.
Could not load type 'Namespace.PageName'.
These errors occur if the .aspx page or the Global.asax page contains a reference to a code-behind module and if the application has not been built.
Use one of the following methods to build the application:
- Use the C# command line compiler (CSC.exe) to run the following command:
csc /t:library /r:System.web.dll /out:mydll.dll myfile.cs
- In Microsoft Visual Studio .NET, click Build on the Build menu.
: Microsoft Visual Basic .NET background compiles the project as soon as it is created. Because Visual C# .NET projects only background parse, you must explicitly build the application.
This behavior is by design.
Steps to Reproduce the Behavior
- Start Visual Studio .NET.
- On the File menu, point to New, and then click Project.
- Click Visual C# Projects under Project Types, and then click ASP.NET Web Application under Templates.
- Right-click WebForm1.aspx, and then click View in Browser.
For more information about building assemblies, visit the following MSDN Web site:
Article ID: 306155 - Last Review: 06/15/2012 07:46:00 - Revision: 4.0
Microsoft ASP.NET 1.0, Microsoft Visual C# .NET 2002 Standard Edition
- kbcompiler kberrmsg kbprb kbwebforms KB306155