繁体   English   中英

将网站转换为 Web 应用程序后编译错误 CS0103

[英]Complie error CS0103 after converting website to webapplication

我有一个旧网站项目,我正在尝试将其转换为 Web 应用程序。 完成转换后,我收到 CS0103 错误。 这是网页代码:

<%@ Page Language="C#" EnableSessionState="false" Inherits="AutoGenerateDCT" Codebehind="AutoGenerateDCT.aspx.cs" %>
<%@ Register TagPrefix="Wisard" TagName="Header" Src="~/User_Controls/Header.ascx" %>
<%@ Register TagPrefix="Wisard" TagName="Footer" Src="~/User_Controls/Footer.ascx" %>

<!DOCTYPE HTML>
<html>

<head>
    <meta http-equiv="X-UA-Compatible" content="AutoGenerateDCT" />
    <title>WISARD Auto Generated Reports - D.C. Tillman Operations Reports</title>
    <link rel="shortcut icon" href="/Wisard/favicon.ico" /> 
    <link rel="icon" type="image/ico" href="/Wisard/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="/Wisard/Styles/Styles.css" />
    <style type="text/css">
    
        .div-group-name 
        {
            width: 110px;
        }
        
        .div-group-description 
        {
            margin-left: 290px;
        }
        
    </style>
    <script type="text/javascript">

        function onLoad() {
            if ("<%= FileNotFound %>" == "True") {
                window.alert("This report does not exist");
            }
        }

这是后面的代码:

public partial class AutoGenerateDCT : SimplePage
{
private String fileNotFound;

private Reports reports;

public override void LoadPage(EventArgs e)
{
    reports = new Reports();

    fileNotFound = Browser.GetCookieValue("FileNotFound");

    Response.Cookies["FileNotFound"].Value = "";

    header.links = "&nbsp;&gt;&gt;&nbsp;<a href=\"/Wisard/App/AutoGenerateGroups.aspx\">Groups</a>&nbsp;&gt;&gt;&nbsp;D.C. Tillman Operations Reports";
}

protected void Page_Unload(Object sender, EventArgs e)
{
    reports?.Dispose();
    reports = null;
}

public String FileNotFound
{
    get { return fileNotFound; }
}

我收到 FileNotFound 变量的 CS0103 错误。 任何想法为什么?

谢谢你,特蕾西

我会在 build->rebuild all 下尝试。

此错误表明代码从未编译过,并且无法解析您拥有的服务器端表达式。

您也可以尝试运行该页面,但最好尝试重新构建所有内容。 如果您有一些代码编译错误,请修复这些错误,并继续进行重新构建,直到您的代码编译错误消失。

一旦编译错误消失,关于表达式的消息(名称在当前上下文中不存在)应该消失。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM