ASP.NETログパス
761 ワード
//1.
protected void Button_StreamWrite_Click(object sender, EventArgs e)
{
StreamWriter sw = new StreamWriter(@"\xxx.log",true);
sw.WriteLine("Start");
sw.WriteLine(" ing...");
sw.WriteLine("End");
sw.Close();
}
C ,true = , , , New ,
//2. web Path
protected void Button_StreamWrite_Click(object sender, EventArgs e)
{
string appPath = HttpContext.Current.Server.MapPath(@"\log.txt");
StreamWriter sw = new StreamWriter(appPath,true);
sw.WriteLine("Start");
sw.WriteLine(" ing...");
sw.WriteLine("End");
sw.Close();
}
app Path ,true = , , , New ,