ASP.NET将网页设为桌面图标实现
创建SetDesktop.aspx页面
然后添加如下代码:
protected void Page_Load(object sender, EventArgs e) { string Url = Request.QueryString["url"]; string Title = Request.QueryString["Title"]; Response.ClearContent(); if (HttpContext.Current.Request.Browser.Browser != "IE") { HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + Title + ".url"); } else { string sitename = HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(Title + ".url")); Response.AddHeader("content-disposition", "attachment; filename=" + sitename); } Response.ContentType = "APPLICATION/OCTET-STREAM"; Response.Write("[InternetShortcut]\r\n"); Response.Write("URL=" + Url + "\r\n"); Response.Write("IDList=\r\n"); Response.Write("[{000214A0-0000-0000-C000-000000000046}]\r\n"); Response.Write(" Prop3=19,2\r\n"); Response.End(); }
调用:location.href = "SetDesktop.aspx?url=" + window.location.href + "&Title=" + document.title;
作者:Crazy Ma
出处:http://www.cnblogs.com/intcry
♪:30%的技术+70%的精神,帮助别人得到他想要的,你就能得到你想要的! ♪