加了格式没转换竟然,应该是这样:<%@ 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>
<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>
http://www.cnblogs.com/insus/archive/2011/03/21/1990274.html
http://www.cnblogs.com/insus/archive/2011/04/21/2023258.html
http://zzk.cnblogs.com/s?w=blog%3Ainsus+meta&t=
<title>
<%=Application["PageTitle"] %></title>
<meta name="keywords" content="<%=Application["PageKeywords"]%>" />
<meta name="description" content="<%=Application["Pagede"] %>" />这些信息不能放到Body中吧
<title>
<%=Application["PageTitle"] %></title>
<meta name="keywords" content="<%=Application["PageKeywords"]%>" />
<meta name="description" content="<%=Application["Pagede"] %>" />这些信息不能放到Body中吧http://zjc369.blog.sohu.com/19374962.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);
}
要用全局变量Application。
并且在Page_Load方法中加上:Page.Header.DataBind(); 或者:在Head中再包裹一个PlaceHolder,把Head中的内容放到PlaceHolder中http://stackoverflow.com/questions/778952/the-controls-collection-cannot-be-modified-because-the-control-contains-code-bl
这没有问题,可以运行。
另外,没有必要使用 Application 集合,那是 asp (10几年前)的程序写法。定义一个 public static 的变量用于绑定就行了。
这没有问题,可以运行。
另外,没有必要使用 Application 集合,那是 asp (10几年前)的程序写法。定义一个 public static 的变量用于绑定就行了。
大P神。
这没有问题,可以运行。
另外,没有必要使用 Application 集合,那是 asp (10几年前)的程序写法。定义一个 public static 的变量用于绑定就行了。不可以的呢。
<meta name="keywords" content="<%=Application["PageKeywords"]%>" />
<meta name="description" content="<%=Application["Pagede"] %>" />
//单引号...
<meta name="keywords" content=‘<%=Application["PageKeywords"]%>’ />
<!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">
<strong><span style="color: #FF0000;"> <title> <%=Application["PageTitle"] %></title>
<meta name="keywords" content='<%=Application["PageKeywords"]%>' />
<meta name="description" content='<%=Application["Pagede"] %>' /></span></strong>
<link href="../CSS/Index/Index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>