添加桌面快捷方式(下载)
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType = "APPLICATION/OCTET-STREAM";
string HostAddr = "";
string icoPath = HttpContext.Current.Server.MapPath("~/logo.ico");//初始化为绝对路径
string icoName = "/Favicon.ico";//修改此处更改url图标或者图标路径,当前路径为根目录,只用修改相对路径,图标的完整路径由下方会自动生成
icoPath = "http://heshch.com" + icoName;//获取服务器域名地址,为快捷方式的地址
HostAddr = "http://heshch.com/";//快捷方式的外部链接
//解决中文乱码
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Charset = "gb2312";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.AppendHeader("content-disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode("heshch", System.Text.Encoding.UTF8) + ".url\"");
HttpContext.Current.Response.Write("[InternetShortcut] \r\n");
HttpContext.Current.Response.Write("URL=" + HostAddr + " \r\n"); //快捷方式的外部链接
HttpContext.Current.Response.Write("IDList= \r\n");
HttpContext.Current.Response.Write("IconFile=" + icoPath + " \r\n"); //图标文件
HttpContext.Current.Response.Write("IconIndex=1 \r\n");
HttpContext.Current.Response.Write("[{000214A0-0000-0000-C000-000000000046}] \r\n");
HttpContext.Current.Response.Write("Prop3=19,2 \r\n");
HttpContext.Current.Response.End();
浙公网安备 33010602011771号