日期:2014-05-18 浏览次数:20436 次
if (File.Exists(Server.MapPath("Test.txt"))) { FileStream fs = new FileStream(Server.MapPath("Test.txt"),FileMode.OpenOrCreate,FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("测试"); sw.Close(); fs.Close(); } else { File.Create(Server.MapPath("Test.txt")); FileStream fs = new FileStream(Server.MapPath("Test.txt"), FileMode.Open, FileAccess.Write); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("测试"); sw.Close(); fs.Close(); }