.NET动态设置和显示Titel、KeyWords、Description
来源:互联网 发布:增广贤文 知乎 编辑:程序博客网 时间:2024/04/29 23:04
namespace Dd_g.Common
{
public partial class createhtml : System.Web.UI.Page
{
//Dd_g——Seo显示在页面,网站title,keyword, description优化
public static void GetSeo(Page page, string strtitle, string strkeywords, string strdescription)
{
if(!strtitle.Equals(""))
page.Header.Title = strtitle;
if (!strkeywords.Equals(""))
{
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "KeyWords";
keyword.Content = strkeywords;
page.Header.Controls.Add(keyword);
}
if (!strdescription.Equals(""))
{
HtmlMeta description = new HtmlMeta();
description.Name = "Description";
description.Content = strdescription;
page.Header.Controls.Add(description);
}
}
//Dd_g——Seo设置,网站title,keyword, description优化,通过设置webconfig
//<configuration>
//<appSettings>
//<add key="Title" value="请填写网站标题" />
//<add key="KeyWords" value="请合理填写网站搜索关键字" />
//<add key="Description" value="请合理填写搜索网站描述" />
//</appSettings>
//</configuration>
public static void SetWebconfigSeo(string strtitle, string strkeywords, string strdescription)
{
Configuration cofig = WebConfigurationManager.OpenWebConfiguration("~/");
cofig.AppSettings.Settings["Title"].Value = strtitle;
cofig.AppSettings.Settings["KeyWords"].Value = strkeywords;
cofig.AppSettings.Settings["Description"].Value = strdescription;
cofig.Save();
}
//Dd_g——Seo获得,网站title,keyword, description优化,通过设置webconfig
//<configuration>
//<appSettings>
//<add key="Title" value="请填写网站标题" />
//<add key="KeyWords" value="请合理填写网站搜索关键字" />
//<add key="Description" value="请合理填写搜索网站描述" />
//</appSettings>
//</configuration>
public static void GetWebconfigSeo()
{
string strtitle = "";
string strkeywords="";
string strdescription = "";
Configuration cofig = WebConfigurationManager.OpenWebConfiguration("~/");
strtitle = cofig.AppSettings.Settings["Title"].Value;
strkeywords = cofig.AppSettings.Settings["KeyWords"].Value;
strdescription = cofig.AppSettings.Settings["Description"].Value;
GetSeo(this.Page, strtitle, strkeywords, strdescription);
} }
}
{
public partial class createhtml : System.Web.UI.Page
{
//Dd_g——Seo显示在页面,网站title,keyword, description优化
public static void GetSeo(Page page, string strtitle, string strkeywords, string strdescription)
{
if(!strtitle.Equals(""))
page.Header.Title = strtitle;
if (!strkeywords.Equals(""))
{
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "KeyWords";
keyword.Content = strkeywords;
page.Header.Controls.Add(keyword);
}
if (!strdescription.Equals(""))
{
HtmlMeta description = new HtmlMeta();
description.Name = "Description";
description.Content = strdescription;
page.Header.Controls.Add(description);
}
}
//Dd_g——Seo设置,网站title,keyword, description优化,通过设置webconfig
//<configuration>
//<appSettings>
//<add key="Title" value="请填写网站标题" />
//<add key="KeyWords" value="请合理填写网站搜索关键字" />
//<add key="Description" value="请合理填写搜索网站描述" />
//</appSettings>
//</configuration>
public static void SetWebconfigSeo(string strtitle, string strkeywords, string strdescription)
{
Configuration cofig = WebConfigurationManager.OpenWebConfiguration("~/");
cofig.AppSettings.Settings["Title"].Value = strtitle;
cofig.AppSettings.Settings["KeyWords"].Value = strkeywords;
cofig.AppSettings.Settings["Description"].Value = strdescription;
cofig.Save();
}
//Dd_g——Seo获得,网站title,keyword, description优化,通过设置webconfig
//<configuration>
//<appSettings>
//<add key="Title" value="请填写网站标题" />
//<add key="KeyWords" value="请合理填写网站搜索关键字" />
//<add key="Description" value="请合理填写搜索网站描述" />
//</appSettings>
//</configuration>
public static void GetWebconfigSeo()
{
string strtitle = "";
string strkeywords="";
string strdescription = "";
Configuration cofig = WebConfigurationManager.OpenWebConfiguration("~/");
strtitle = cofig.AppSettings.Settings["Title"].Value;
strkeywords = cofig.AppSettings.Settings["KeyWords"].Value;
strdescription = cofig.AppSettings.Settings["Description"].Value;
GetSeo(this.Page, strtitle, strkeywords, strdescription);
} }
}
0 0
- .NET动态设置和显示Titel、KeyWords、Description
- 动态设置网页Description和Keywords
- asp.net 动态设置标题title、meta(keywords、description)
- 动态设置标题title、keywords、description
- asp.net动态添加Meta(author、description、keywords)
- .net 后台设置meta的属性(keywords,description)
- .net 后台设置meta的属性(keywords,description)
- 网页动态关键字和描述(Keywords,description)
- Discuz门户keywords和description不能正确显示
- ASP.NET 如何动态修改 Header 属性如添加 Meta 标签 keywords description!
- ASP.NET 如何动态修改 Header 属性如添加 Meta 标签 keywords description!
- ASP.NET后台动态修改母板页的Title,keywords,description属性
- 【ASP.NET】对不同产品的动态网页添加不同的title、keywords、description
- ASP.NET 如何动态修改 Header 属性如添加 Meta 标签 keywords description!
- 正确设置网站title、keywords、description
- asp.net网站中,全站统一设置title,keywords,description的实现方案
- 动态修改aspx页面的meta标签中的 keywords 和description
- C#在后台添加keywords和description
- 迅雷离线下载与高速通道运作原理详解
- PermGen space(内存溢出)
- jsoup
- 使用adb输入中文字符
- matlab编程入门学习(1)
- .NET动态设置和显示Titel、KeyWords、Description
- Android 内存泄露问题
- 屏蔽CTRL+ALT+DEL热键
- ArcGIS栅格重采样方法
- VC 使用msxml6.dll动态链接库中的函数读写XML文件
- SHELLEXECUTEINFO 和 ShellExecuteEx的使用
- mysql中时间日期的处理
- NDK不用cygwin,只用eclipse开发,照样能编译成 .so文件
- 文本框只能输入数字