Web项目写入一个temp.txt文件:
if (!this.IsPostBack)
{
System.IO.StreamWriter sw = new System.IO.StreamWriter(Server.MapPath(".") + "\\" + "temp.txt");
sw.WriteLine("这里是写入的文本。");
sw.WriteLine("再写一行");
sw.Flush();
sw.Close();
}
该文章转自:站点基地 ".net中将文本导出为txt文件的方法"一文