public void UpdateMeta(string title, string keyword, string desc)
    {

        for (int i = this.Header.Controls.Count - 1; i >= 0; i--)
        {
            if (this.Header.Controls[i].GetType() == typeof(HtmlMeta))
            {
                HtmlMeta hmt = (HtmlMeta)this.Header.Controls[i];
                if (hmt.Attributes["name"] != null)
                    this.Header.Controls.RemoveAt(i);
            }
        }
        this.Page.Title = title;

        HtmlMeta hm = new HtmlMeta();
        hm.Name = "keywords";
        hm.Content = keyword;
        Header.Controls.AddAt(1, hm);

        HtmlMeta hm1 = new HtmlMeta();
        hm1.Name = "description";
        hm1.Content = desc;
        Header.Controls.AddAt(2, hm1);
    }

 

相关文章:

  • 2022-12-23
  • 2022-02-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-11-15
  • 2022-02-05
  • 2022-12-23
猜你喜欢
  • 2021-09-16
  • 2021-04-25
  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-02-18
相关资源
相似解决方案