1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Collections;
5 using System.Web;
6 using System.Web.Security;
7 using System.Web.UI;
8 using System.Web.UI.WebControls;
9 using System.web.ui.webcontrols.webparts;
Using System.Web.UI.HtmlControls;
11
public partial class Createshortcut:system.web.ui.page
13 {
protected void Page_Load (object sender, EventArgs e)
15 {
16}
17
///<summary>
19///Create shortcuts
///</summary>
///<param name= "title" > title </param>
///<param name= "url" >url address </param>
-private void CreateShortcut (string title, String url)
24 {
Strfavoritefolder string;
26
27//"Favorites" to create IE shortcuts
Strfavoritefolder = System.environment.getfolderpath (environment.specialfolder.favorites);
Createshortcutfile (title, URL, strfavoritefolder);
30
31//"desktop" to create IE shortcuts
Strfavoritefolder = System.environment.getfolderpath (environment.specialfolder.desktop);
Createshortcutfile (title, URL, strfavoritefolder);
34
35//"link" to create IE shortcuts
Strfavoritefolder = System.environment.getfolderpath (environment.specialfolder.favorites) + "link";
Panax Notoginseng createshortcutfile (title, URL, strfavoritefolder);
38
39//"Start Menu Create IE shortcut
Strfavoritefolder = System.environment.getfolderpath (Environment.specialfolder.startmenu);
Createshortcutfile (title, URL, strfavoritefolder);
42
43}
44
///<summary>
46///Create Shortcuts
///</summary>
///<param name= "title" > title </param>
///<param name= "url" >url address </param>
///<param name= "SpecialFolder" > Special folders </param>
Wu private void Createshortcutfile (string title, string URL, string specialfolder)
52 {
//Create Shortcut file, based on title
System.IO.StreamWriter Objwriter = system.io.file.createtext (SpecialFolder + "" + title + ". url");
//write URL to file
Objwriter.writeline ("[Internetshortcut]");
Objwriter.writeline ("url=" + URL);
%//close file
Objwriter.close ();
60}
61
The private void Btnshortcut_click (object sender, System.EventArgs e)
63 {
CreateShortcut ("It Bird's column-blog Circle", http://www.111cn.net/);
65}
66}