public void SetLog(string content) { string hh = Server.MapPath("/log/") + DateTime.Now.ToString("yyyyMMdd") + ".txt"; if (!File.Exists(hh)) { string dir = Path.GetDirectoryName(hh); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } } FileStream fs = new FileStream(hh, FileMode.Append, FileAccess.Write, FileShare.Read); StreamWriter sw = new StreamWriter(fs); sw.WriteLine(content); sw.Close(); fs.Close(); }