62,042
社区成员
发帖
与我相关
我的任务
分享
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Index.master.cs" Inherits="Web.Template.Index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title> <%=Application["PageTitle"] %></title>
<meta name="keywords" content="<%=Application["PageKeywords"]%>" />
<meta name="description" content="<%=Application["Pagede"] %>" />
<link href="../CSS/Index/Index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
</div>
“/”应用程序中的服务器错误。
--------------------------------------------------------------------------------
控件包含代码块(即 <% ... %>),因此无法修改控件集合。
<meta name="keywords" content="<%=Application["PageKeywords"]%>" />
<meta name="description" content="<%=Application["Pagede"] %>" />
//单引号...
<meta name="keywords" content=‘<%=Application["PageKeywords"]%>’ />
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Index.master.cs" Inherits="Web.Template.Index" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>
<%=Application["PageTitle"] %></title>
<meta name="keywords" content="<%=Application["PageKeywords"]%>" />
<meta name="description" content="<%=Application["Pagede"] %>" />
<link href="../CSS/Index/Index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
///
/// 添加Meta标签
///
/// 页面
/// Meta名字
/// Meta内容
public void AddMeta(System.Web.UI.Page page, string name, string content)
{
HtmlMeta meta = new HtmlMeta();
meta.Name = name;
meta.Content = content;
page.Header.Controls.Add(meta);
}