private static void Log(string content, string fileName="log.txt") { string logsPath = AppDomain.CurrentDomain.BaseDirectory + "\App_Code\logs\"; string filename = logsPath + fileName; if (!Directory.Exists(logsPath)) Directory.CreateDirectory(logsPath); StreamWriter sr = null; try { if (!File.Exists(filename)) { sr = File.CreateText(filename); } else { sr = File.AppendText(filename); } sr.WriteLine(content); } catch { } finally { if (sr != null) sr.Close(); } }