C# 尝试运行ASP.NET应用程序时出现分析错误

C# 尝试运行ASP.NET应用程序时出现分析错误,c#,.net,visual-studio,parse-error,C#,.net,Visual Studio,Parse Error,我正在尝试运行ASP.NET应用程序,但当我的页面加载时,它会显示以下内容: Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify

我正在尝试运行ASP.NET应用程序,但当我的页面加载时,它会显示以下内容:

Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'CMSMessages_Error'.

Source Error:


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" Inherits="CMSMessages_Error"
Line 2:      Theme="Default"  Codebehind="Error.aspx.cs" %>
Line 3:  <%@ Register src="~/CMSAdminControls/UI/PageElements/PageTitle.ascx" tagname="PageTitle" tagprefix="cms" %>

Source File: /CMSMessages/error.aspx    Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4261.0
“/”应用程序中出现服务器错误。 分析器错误 描述:解析服务此请求所需的资源时出错。请查看以下特定的解析错误详细信息,并适当修改源文件。 分析器错误消息:无法加载类型“CMSMessages_Error”。 源错误: 第1行: 第3行: 源文件:/CMSMessages/error.aspx行:1 版本信息:Microsoft.NET Framework版本:4.0.30319;ASP.NET版本:4.8.4261.0

这是与我认为导致错误的页面相关的代码

PageTitle.ascx

<%@ Control Language="C#" AutoEventWireup="true"  Codebehind="PageTitle.ascx.cs" Inherits="CMSAdminControls_UI_PageElements_PageTitle" %>

<%@ Register Src="~/CMSAdminControls/UI/PageElements/Help.ascx" TagName="Help" TagPrefix="cms" %>
<%@ Register Src="~/CMSAdminControls/UI/PageElements/BreadCrumbs.ascx" TagName="Breadcrumbs" TagPrefix="cms" %>

<asp:Panel runat="server" ID="pnlBody">
    <asp:Panel runat="server" ID="pnlTitle" CssClass="dialog-header non-selectable" Visible="false">
        <div class="dialog-header-action-buttons">
            <div class="action-button">
                <cms:Help ID="helpElem" runat="server" IconCssClass="cms-icon-80" />
            </div>
            <asp:PlaceHolder runat="server" ID="plcMisc" />
            <asp:Panel runat="server" ID="pnlMaximize" CssClass="action-button" Visible="False" EnableViewState="False">
                <a>
                    <span class="sr-only"><%= GetString("general.fullscreen") %></span>
                    <i id="btnMaximize" runat="server" class="icon-modal-maximize cms-icon-80" aria-hidden="true"></i>
                </a>
            </asp:Panel>
            <asp:Panel runat="server" ID="pnlClose" CssClass="action-button close-button" Visible="False" EnableViewState="False">
                <a>
                    <span class="sr-only"><%= GetString("general.close") %></span>
                    <i id="btnClose" runat="server" class="icon-modal-close cms-icon-150" aria-hidden="true"></i>
                </a>
            </asp:Panel>
        </div>
        <cms:LocalizedHeading runat="server" ID="headTitle" CssClass="dialog-header-title" EnableViewState="false" />
        <asp:Label ID="lblTitleInfo" runat="server" CssClass="PageTitleInfo" EnableViewState="false" Visible="false" />
    </asp:Panel>
    <cms:Breadcrumbs ID="breadcrumbs" runat="server" />
</asp:Panel>

PageTitle.ascx.cs

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

using CMS.Base.Web.UI;
using CMS.DataEngine;
using CMS.DeviceProfiles;
using CMS.Helpers;
using CMS.UIControls;


public partial class CMSAdminControls_UI_PageElements_PageTitle : PageTitle
{
    #region "Public properties"

    /// <summary>
    /// Breadcrumbs control
    /// </summary>
    public override Breadcrumbs Breadcrumbs
    {
        get
        {
            return breadcrumbs;
        }
    }


    /// <summary>
    /// Title CSS class.
    /// </summary>
    public override string TitleCssClass
    {
        get
        {
            return pnlTitle.CssClass;
        }
        set
        {
            pnlTitle.CssClass = value;
        }
    }


    /// <summary>
    /// Topic name can be either a perma link, or absolute URL.
    /// </summary>
    public override string HelpTopicName
    {
        get
        {
            return helpElem.TopicName;
        }
        set
        {
            helpElem.TopicName = value;
            breadcrumbs.Help.TopicName = value;
        }
    }


    /// <summary>
    /// Help name to identify the help within the javascript.
    /// </summary>
    public override string HelpName
    {
        get
        {
            return helpElem.HelpName;
        }
        set
        {
            helpElem.HelpName = value;
            breadcrumbs.Help.HelpName = value;
        }
    }


    /// <summary>
    /// Help icon name for title.
    /// </summary>
    public override string HelpIconName
    {
        get
        {
            return helpElem.IconName;
        }
        set
        {
            helpElem.IconName = value;
        }
    }


    /// <summary>
    /// Placeholder after image and title text.
    /// </summary>
    public override PlaceHolder RightPlaceHolder
    {
        get
        {
            return plcMisc;
        }
        set
        {
            plcMisc = value;
        }
    }

    #endregion


    #region "Dialog properties"

    /// <summary>
    /// Indicates if the control should use the string from resource file.
    /// </summary>
    public bool UseFileStrings
    {
        get;
        set;
    }

    #endregion


    #region "Page events"

    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (StopProcessing)
        {
            return;
        }

        // Register jQuery
        ScriptHelper.RegisterJQuery(Page);

        // Use dark help icon for dialogs
        helpElem.IsDialog = IsDialog;

        // Set breadcrumbs visibility
        breadcrumbs.HideBreadcrumbs = HideBreadcrumbs;

        // Set level of h element
        headTitle.Level = HeadingLevel;

        // Set the title text if set
        if (!string.IsNullOrEmpty(TitleText))
        {
            if (!HideTitle)
            {
                pnlTitle.Visible = true;
                headTitle.Text = TitleText;
            }
        }
        else
        {
            pnlTitle.Visible = false;
            breadcrumbs.Help.Visible = true;
        }

        // Set the title info if set
        if (!string.IsNullOrEmpty(TitleInformation))
        {
            lblTitleInfo.Text = TitleInformation;
            lblTitleInfo.Visible = true;
        }

        // Register scripts only when needed
        if (pnlTitle.Visible)
        {
            EnsureFullScreenButton();

            EnsureCloseButton();

            EnsureDraggable();
        }

        if (!Wrap)
        {
            headTitle.Style.Add("white-space", "nowrap");
        }
    }

    #endregion


    #region "Methods"

    private void EnsureDraggable()
    {
        // Load draggable iframe script
        ScriptHelper.RegisterScriptFile(Page, "DragAndDrop/dragiframe.js");

        ScriptHelper.RegisterGetTopScript(Page);

        // Initialize draggable behavior
        ScriptHelper.RegisterStartupScript(this, typeof (string), "draggableFrame", ScriptHelper.GetScript(
@"$cmsj(window).load(function(){
var topFrame = GetTop();
if(window.wopener)
{
    if((top.isTitleWindow) && top.isTitleWindow(topFrame, window))
    {
        addHandle(document.getElementById('" + pnlTitle.ClientID + @"'), window);
    }
}
});"));
    }


    private void EnsureFullScreenButton()
    {
        if (ShowFullScreenButton && IsDialog)
        {
            pnlMaximize.Visible = true;
            btnMaximize.Attributes.Add("onclick", "return fs_" + ClientID + "($cmsj(this));");
            btnMaximize.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
            string fsToolTip = GetString("general.fullscreen");
            btnMaximize.Attributes.Add("title", fsToolTip);

            //Call PageTitle's GetString (no reshelper) - fix problem with no DB connection avaible
            string fullScreenScript = @"
function titleFullScreen(sender)
{
    if(top.toggleFullScreen)
    {
        top.toggleFullScreen();
        toggleFullScreenIcon(sender);
    }
    return false;
}

function toggleFullScreenIcon(sender)
{
    var btn = sender;
    btn.toggleClass('icon-modal-maximize');
    btn.toggleClass('icon-modal-minimize');
    if(btn.hasClass('icon-modal-minimize'))
    {
        sender.attr('title', " + ScriptHelper.GetString(GetString("general.restore")) + @");
    }
    else
    {
        sender.attr('title', '" + fsToolTip + @"');
    }
}";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "fullScreenScript", ScriptHelper.GetScript(fullScreenScript));

            // Register fullscreen button for new dialogs
            string fsVar = @"
function fs_" + ClientID + @"(sender)
{
    return titleFullScreen(sender);
}";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "fsVar_" + ClientID, ScriptHelper.GetScript(fsVar));

            string fsInit = @"
$cmsj(document).ready(function(){
    if(window.wopener && (top != null) && top.$visiblePopup)
    {  
        var topFrame = GetTop();
        if(top.isTitleWindow(topFrame, window) && !topFrame.fullScreenButtonAvailable)
        {
            var fsButton = $cmsj('#" + btnMaximize.ClientID + @"');
            if(top.isFullScreen())
            {
                toggleFullScreenIcon(fsButton);
            }
            fsButton.show(); 
            $cmsj('#" + pnlBody.ClientID + @"').dblclick(function(){return fs_" + ClientID + @"(fsButton);});
            topFrame.setToFullScreen = function () { return !top.isFullScreen() ? fs_" + ClientID + @"(fsButton) : false; };
            topFrame.fullScreenButtonAvailable = true;
            $cmsj(window).unload(function() {
                topFrame.fullScreenButtonAvailable = false;
            });
        }
    }
});";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "fsInit_" + ClientID, ScriptHelper.GetScript(fsInit));
        }
    }


    private void EnsureCloseButton()
    {
        if (ShowCloseButton && (DeviceContext.CurrentDevice.IsMobile || IsDialog))
        {
            pnlClose.Visible = true;
            btnClose.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
            btnClose.Attributes.Add("title", GetString("general.close"));

            // Always close the window
            btnClose.Attributes["onclick"] += ";return CloseDialog();";
        }
    }


    /// <summary>
    /// Returns localized string.
    /// </summary>
    /// <param name="stringName">String to localize</param>
    /// <param name="culture">Culture</param>
    public override string GetString(string stringName, string culture = null)
    {
        if (UseFileStrings || !ConnectionHelper.ConnectionAvailable)
        {
            return ResHelper.GetFileString(stringName, culture);
        }

        return base.GetString(stringName, culture);
    }

    #endregion


    public void SetCloseJavaScript(string javaScript)
    {
        btnClose.Attributes.Add("onclick", javaScript);
    }
}
使用系统;
使用System.Web.UI;
使用System.Web.UI.WebControl;
使用CMS.Base.Web.UI;
使用CMS.DataEngine;
使用CMS.DeviceProfiles;
使用CMS.Helpers;
使用CMS.UIControls;
公共部分类CMSAdminControls\u UI\u PageElements\u PageTitle:PageTitle
{
#区域“公共财产”
/// 
///面包屑控制
/// 
公共覆盖面包屑面包屑
{
得到
{
返回面包屑;
}
}
/// 
///标题CSS类。
/// 
公共重写字符串标题类
{
得到
{
返回pnltite.CssClass;
}
设置
{
pnlTitle.CssClass=值;
}
}
/// 
///主题名称可以是永久链接,也可以是绝对URL。
/// 
公共重写字符串HelpTopicName
{
得到
{
返回helpElem.TopicName;
}
设置
{
helpElem.TopicName=值;
breadcrumbs.Help.TopicName=值;
}
}
/// 
///帮助名称,用于标识javascript中的帮助。
/// 
公共重写字符串帮助名
{
得到
{
返回helpElem.HelpName;
}
设置
{
helpElem.HelpName=值;
breadcrumbs.Help.HelpName=值;
}
}
/// 
///标题的帮助图标名称。
/// 
公共重写字符串HelpIconName
{
得到
{
返回helpElem.IconName;
}
设置
{
helpElem.IconName=值;
}
}
/// 
///图像和标题文本后的占位符。
/// 
公共替代占位符RightPlaceHolder
{
得到
{
返回plcMisc;
}
设置
{
plcMisc=值;
}
}
#端区
#区域“对话框属性”
/// 
///指示控件是否应使用资源文件中的字符串。
/// 
公共bool UseFileStrings
{
得到;
设置
}
#端区
#区域“页面事件”
受保护的无效页面\u预呈现(对象发送方,事件参数e)
{
如果(停止处理)
{
返回;
}
//注册jQuery
ScriptHelper.RegisterJQuery(第页);
//对对话框使用黑色帮助图标
helpElem.IsDialog=IsDialog;
//设置面包屑的可见性
面包屑.HideBreadcrumbs=HideBreadcrumbs;
//设置h元素的级别
headTitle.Level=HeadingLevel;
//设置标题文本(如果已设置)
如果(!string.IsNullOrEmpty(TitleText))
{
如果(!隐藏)
{
pnlTitle.Visible=true;
headTitle.Text=TitleText;
}
}
其他的
{
pnlTitle.Visible=false;
breadcrumbs.Help.Visible=true;
}
//设置标题信息(如果已设置)
如果(!string.IsNullOrEmpty(标题信息))
{
lblTitleInfo.Text=标题信息;
lblTitleInfo.Visible=true;
}
//仅在需要时注册脚本
如果(pNTITLE.可见)
{
确保重新安装ScreenButton();
重新关闭按钮();
确保可破坏();
}
如果(!Wrap)
{
标题。样式。添加(“空白区”、“nowrap”);
}
}
#端区
#区域“方法”
私有无效
{
//加载可拖动的iframe脚本
RegisterScriptFile(第页,“DragAndDrop/dragiframe.js”);
ScriptHelper.RegisterGetTopScript(第页);
//初始化可拖动行为
RegisterStartupScript(这个,typeof(string),“draggableFrame”,ScriptHelper.GetScript(
@“$cmsj(窗口).load(函数(){
var topFrame=GetTop();
如果(窗口,wopener)
{
if((顶部isTitleWindow)和顶部isTitleWindow(顶部框架,窗口))
{
addHandle(document.getElementById(“+pnltle.ClientID+@”),窗口);
}
}
});"));
}
private void EnsureRefllScreenButton()的
{
if(显示完整屏幕按钮和IsDialog)
{
pnlMaximize.Visible=true;
Add(“onclick”,“return fs_u“+ClientID+”($cmsj(this));”);
btnMaximize.Style.Add(HtmlTextWriterStyle.Cursor,“指针”);
string fsToolTip=GetString(“general.fullscreen”);
btnMaximize.Attributes.Add(“标题”,fsToolTip);
//调用PageTitle的GetString(无reshelper)-修复没有可用DB连接的问题
字符串fullScreenScript=@”
功能标题FullScreen(发送器)
{
如果(顶部。切换全屏)
{
toggleFullScreen();
切换全屏图标(发送方);
}
返回false;
}
功能切换FullScreen图标(发送者)
{
var btn=发送方;
btn.toggleClass('icon-modal-maximize');
btn。