public static void LogWrite(string str)
{
//项目根目录
string path = HttpContext.Current.Server.MapPath("~") + "ilogs.txt";
if (!File.Exists(path))
{
FileStream fs = new FileStream(path, FileMode.Create,FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(fs);
sw.Write(str);
sw.Flush();
sw.Close();
}
else
{
FileStream fs = new FileStream(path, FileMode.Append);
//文本写入
StreamWriter sw = new StreamWriter(fs);
sw.Write(str);
sw.Flush();
sw.Close();
}
}