aspx文件的head属性中增加runat="server"
后台cs文件中:
/// <summary> /// 客户端注册ICO图标 /// </summary> /// <param name="ico_img_url"></param> private void RegeistICO(string ico_img_url) { System.Text.StringBuilder str = new System.Text.StringBuilder(); str.Append("<link rel="bookmark" type="image/x-icon" href="" + ico_img_url + ""/>"); str.Append("<link rel="shortcut icon" href="" + ico_img_url + ""> "); str.Append("<link rel="icon" href="" + ico_img_url + "">"); Literal li = new Literal(); li.Text = str.ToString(); this.Page.Header.Controls.Add(li); }
page_load中调用这个方法,传入ico图标的路径就OK了