protected void Button1_Click(object sender, EventArgs e)
{
string Path = @"D:\str.txt";
string str = TextBox1.Text;
WriteFile(Path,str );
}
public static void WriteFile(string Path,string str)
{
if (!System.IO.File.Exists(Path))
{
System.IO.FileStream f = System.IO.File.Create(Path);
f.Close();
}
System.IO.StreamWriter f2 = new System.IO.StreamWriter(Path, true, System.Text.Encoding.GetEncoding("gb2312"));
f2.WriteLine(str);
f2.Flush();
f2.Close();
f2.Dispose();
}