zoukankan      html  css  js  c++  java
  • 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%的精神,帮助别人得到他想要的,你就能得到你想要的! ♪

  • 相关阅读:
    自定义函数
    内置函数
    炸裂函数explode
    -bash:ls:command not found,执行命令总是报找不到
    函数
    C#的lock用法
    获取客户端Ip地址方法
    Grunt基础
    常用Sql
    HandleBars
  • 原文地址:https://www.cnblogs.com/intcry/p/2132306.html
Copyright © 2011-2022 走看看