PRB: "Could not load type" error message when you browse to .aspx page by using Visual C# .NET

Reference from http://support.microsoft.com/kb/306155

当浏览C# .NET 的aspx 页时出现"Could not load type" 错误

症状:

当浏览一个.aspx页,可能会收到以下错误信息:

Could not load type 'Namespace.Global'.

-或-

Could not load type 'Namespace.PageName'.

原因:

这些错是因为aspx 页或Global.asax 包含一些后台代码模块的引用但应用程序却没有编译。

解决方案:

用以下方法编译应用程序:

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.

NOTE: 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.


APPLIES TO

Microsoft ASP.NET 1.0

Microsoft Visual C# .NET 2002 Standard Edition