昨天接到老大的任务,因为做SEO,好像是用到了Title,keywords,description,要动态去实现
然后我就开始整了
1、在母板页的cs文件中写如下:
protected string _titles = "";
public string Titles
{
get { return _titles; }
set { this._titles = value; }
}
protected string _keyword = "";
public string KeyWord
{
get { return _keyword; }
set { this._keyword = value; }
}
protected string _description = "";
public string Description
{
get { return _description; }
&nbs

本文介绍如何在ASP.NET中动态修改母板页的Title、keywords和description属性,以实现SEO优化。通过在母板页的CS文件定义相应属性,并在Page事件中调用SetKD()方法,更新HtmlTitle和HtmlMeta标签内容。在具体使用母板页的页面中,通过<%@ MasterType %>指令引用母板,并在CS后台代码中设置属性值。
最低0.47元/天 解锁文章
3677

被折叠的 条评论
为什么被折叠?



