System.IO.StreamWriter w = new System.IO.StreamWriter(Server.MapPath("~/App_data/xxx.log"), true);
w.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " IP:" + clientIp + " UserName:" + this.Login1.UserName);
w.Close();
原文:http://www.cnblogs.com/huangjing/p/7452423.html