protected void WriteLog(string msg) { using (FileStream fs = new FileStream(@"C:\Log\Log.txt", FileMode.OpenOrCreate, FileAccess.Write,FileShare.Write,20480,true)) { StreamWriter writer = new StreamWriter(fs); fs.Seek(0, SeekOrigin.End); writer.WriteLine(DateTime.Now.ToString() + "---" + msg); writer.Flush(); writer.Close(); } }