Asp.NET生成各种网页快捷方式(桌面url快捷方式,收藏夹/开始菜单快捷方式)
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
-
- public partial class CreateShortcut : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
-
-
-
-
-
-
- private void CreateShortcut(string Title, string URL)
- {
- string strFavoriteFolder;
-
-
- strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
- CreateShortcutFile(Title, URL, strFavoriteFolder);
-
-
- strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
- CreateShortcutFile(Title, URL, strFavoriteFolder);
-
-
- strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Favorites) + "\\链接";
- CreateShortcutFile(Title, URL, strFavoriteFolder);
-
-
- strFavoriteFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
- CreateShortcutFile(Title, URL, strFavoriteFolder);
-
- }
-
-
-
-
-
-
-
- private void CreateShortcutFile(string Title, string URL, string SpecialFolder)
- {
-
- System.IO.StreamWriter objWriter = System.IO.File.CreateText(SpecialFolder + "\\" + Title + ".url");
-
- objWriter.WriteLine("[InternetShortcut]");
- objWriter.WriteLine("URL=" + URL);
-
- objWriter.Close();
- }
-
- private void btnShortcut_Click(object sender, System.EventArgs e)
- {
- CreateShortcut("IT鸟的专栏 - 博客圆", http:
- }
- }