• .net 后台设置meta的属性(keywords,description)


    首先在前台aspx文件中的head标记添加runat="server"的属性。
    之后后台如下编写:
    protected void Page_Load(object sender, EventArgs e)
    {
      //Page title
      Page.Title = "This is a title and meta test page.";
      //Encode/Content type
      HtmlMeta encode = new HtmlMeta();
      encode.HttpEquiv = "Content-Type";
      encode.Content = "text/html; charset=utf-8";
      Page.Header.Controls.Add(encode);
      //Language
      HtmlMeta lang = new HtmlMeta();
      lang.HttpEquiv = "Content-Language";
      lang.Content = "zh-cn";
      Page.Header.Controls.Add(lang);
      //Description
      HtmlMeta desc = new HtmlMeta();
      desc.Name = "Description";
      desc.Content = "Test the meta controls";
      Page.Header.Controls.Add(desc);
      //Keyword
      HtmlMeta keywords = new HtmlMeta();
      keywords.Name = "keywords";
      keywords.Content = "title,meta,test,page";
      Page.Header.Controls.Add(keywords);
    }
    经过测试可以使用。
     
  • 相关阅读:
    Fundamentals of Garbage Collection
    CLR的八大特性
    Navigation and Pathfinding
    Work-Stealing in .NET 4.0
    Graphics.Blit
    整数的可除性
    关于强度
    重心坐标空间
    性能测试中TPS和并发用户数
    LoadRunner 12.02 安装以及汉化教程
  • 原文地址:https://www.cnblogs.com/dodui/p/3255440.html
Copyright © 2020-2023  润新知