看一下还比较实用吧
try
{
System.IO.FileStream fs1 = new System.IO.FileStream(HttpContext.Current.Server.MapPath("../labourdb/logtxt.txt"), System.IO.FileMode.Append);
System.IO.StreamWriter sw1 = new System.IO.StreamWriter(fs1);
sw1.WriteLine("**************************************************");
sw1.WriteLine("日期:" + System.DateTime.Now);
sw1.WriteLine("登入名:" + txt_id.Text);
sw1.WriteLine("密码:" + txt_pwd.Text);//51aspx
sw1.WriteLine("IP:" + Request.ServerVariables["REMOTE_ADDR"].ToString());
sw1.WriteLine("*************************************************");
sw1.Close();
}
catch
{
throw;
}
try
{
System.IO.FileStream fs1 = new System.IO.FileStream(HttpContext.Current.Server.MapPath("../labourdb/logtxt.txt"), System.IO.FileMode.Append);
System.IO.StreamWriter sw1 = new System.IO.StreamWriter(fs1);
sw1.WriteLine("**************************************************");
sw1.WriteLine("日期:" + System.DateTime.Now);
sw1.WriteLine("登入名:" + txt_id.Text);
sw1.WriteLine("密码:" + txt_pwd.Text);//51aspx
sw1.WriteLine("IP:" + Request.ServerVariables["REMOTE_ADDR"].ToString());
sw1.WriteLine("*************************************************");
sw1.Close();
}
catch
{
throw;
}