Skip to main content
 首页 » 编程设计

c#之是否可以从后面的代码编辑元描述

2024年02月23日15傻小

在 Visual Studio 2005 网站的母版页中,我使用元描述作为

<meta name="keywords" content="coupons, coupons, online coupons, health deals, health coupons, computer coupons, bargains, hot bargains" /> 
<meta name="description" content="<%=MyMetaDescription%>" />  

我想替换每个 aspx 页面中的内容。我该如何使用它? 尽管我尝试替换页面后面的代码中的内容,但我得到的内容与描述相同。

在后面的代码中,我调用了 Master.MyMetaDescription = "";

谁能帮我解决这个问题。非常感谢!

请您参考如下方法:

我会用这个:

 this.Page.MetaKeywords = "football, sport, golf"; 
 this.Page.MetaDescription = "My site is all about football and golf"; 

显然,如果您只想附加到它们,则只需使用 +=(不要忘记前导 , 作为关键字)。