怎么在后台修改前台html页面的key、title、description

 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);
    }
原文地址:https://www.cnblogs.com/ZX-LMY/p/6163579.html