简体   繁体   中英

Complie error CS0103 after converting website to webapplication

I have an old website project that I am attempting to convert to a web application. After doing the conversion, I am receiving CS0103 errors. Here is the web page code:

<%@ 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");
            }
        }

Here is the code behind:

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; }
}

I am getting the CS0103 error for the FileNotFound variable. Any ideas why?

Thank You, Tracy

I would try under build->rebuild all.

This error suggests that the code never been compiled, and it can't resolve that server side expression you have.

You could also try running the page, but better would be to try a re-build all. If you have some code compile errors, then fix those, and keep on doing a re-build until your code compile errors are gone.

Once the compile errors are gone, then that message about the expression (the name does not exist in the current context) should go away.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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