嗨,我想創建使用空網站的asp.net應用程序。 我已經創建了一個App_Code文件夾的一個文件夾的Utils內創建在其內部一個「CommonConstants.cs」文件,宣告一些屬性和要如下所示來訪問文件的Login.aspx那些性質,但它顯示「Common.Constants確實不包含「APPLICATION_TITLE」,同時也內CommonConstants.cs顯示錯誤的屬性定義「的類型或命名空間名稱APPLICATION_TITLE「找不到」。任何想法將不勝感激。類不包含定義其屬性
CommonConstants.cs
public class CommonConstants
{
public const APPLICATION_TITLE = "Description of Project";
public const FOOTER_YEAR = "2016";
public const APPLICATION_DESC = "Short Desc";
public const LOGIN_TITLE = "Login";
}
的Login.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />Utils
<link rel="Shortcut Icon" href="Images/favicon.ico" />
<title><%CommonConstants.APPLICATION_TITLE%></title>
你的財產d小甜甜是錯誤的。您需要爲每個屬性指定類型。 '公共常量字符串APPLICATION_TITLE =「項目的說明」;'' –
=的CodeFile「Login.aspx.cs」'那麼,這是什麼'CommonConstants'定義它? –
@RubenVardanyan感謝它的工作。 – micky