Copy Code code as follows: 
 
 
  
 
 
Using System; 
 
Using System.Collections; 
 
Using System.ComponentModel; 
 
Using System.Data; 
 
Using System.Drawing; 
 
Using System.Web; 
 
Using System.Web.SessionState; 
 
Using System.Web.UI; 
 
Using System.Web.UI.WebControls; 
 
Using System.Web.UI.HtmlControls; 
 
Using System.Text; 
 
Using System.IO; 
 
Namespace New_app 
 
{ 
 
<summary> 
 
Summary description of the myxml. 
 
</summary> 
 
public class Myxml:System.Web.UI.Page 
 
{ 
 
Private Const string file_name = "D:\MyFile.txt"; 
 
private void Page_Load (object sender, System.EventArgs e) 
 
{ 
 
Place user code here to initialize page 
 
Write_file (file_name); 
 
} 
 
A way to create a file and enter it in a file 
 
public void Write_file (string file_name) 
 
{ 
 
if (file.exists (file_name)) 
 
{ 
 
Console.WriteLine ("{0} already exists.", file_name); 
 
Return 
 
} 
 
StreamWriter sr = File.createtext (file_name); 
 
Sr. WriteLine ("This is my first program."); 
 
Sr. WriteLine ("by zixian2005"); 
 
Sr. Close (); 
 
} 
 
Code generated #region the Web forms Designer 
 
Override protected void OnInit (EventArgs e) 
 
{ 
 
// 
 
CodeGen: This call is required for the ASP.net Web forms Designer. 
 
// 
 
InitializeComponent (); 
 
Base. OnInit (e); 
 
} 
 
<summary> 
 
Designer supports required methods-do not use the Code editor to modify 
 
The contents of this method. 
 
</summary> 
 
private void InitializeComponent () 
 
{ 
 
This. Load + = new System.EventHandler (this. Page_Load); 
 
} 
 
#endregion 
 
} 
 
}