无法加载类型'System.UI.Page'配置错误

时间:2015-03-18 16:17:22

标签: c# asp.net asp.net-mvc web-config

我在尝试在ASP.NET MVC应用程序的文件夹中显示ASP.NET Web表单页面时收到此错误。我错过了装配参考或包装吗?

Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load type 'System.UI.Page'.

Source Error:


Line 324:        </mobileControls>
Line 325:
Line 326:        <pages pageBaseType="System.UI.Page" userControlBaseType="System.UI.UserControl">
Line 327:            <namespaces>
Line 328:                <add namespace="System" />


Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config    Line: 326

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212 

1 个答案:

答案 0 :(得分:1)

Page不在System.UI中。它位于System.Web.UI程序集中的System.Web命名空间中。您应默认引用System.Web,因此只需在web.config中修复完全限定名称即可。同样适用于UserControl类。

<pages pageBaseType="System.Web.UI.Page" userControlBaseType="System.Web.UI.UserControl">