protected override void OnException(ExceptionContext filterContext) { base.OnException(filterContext); this.SaveLog(filterContext.Exception); } private void SaveLog(Exception e) { string filepath = AppDomain.CurrentDomain.BaseDirectory; string logFilePath = filepath + @"logs\error\log.txt"; using (StreamWriter sw = System.IO.File.AppendText(logFilePath)) { sw.WriteLine("Message: " + e.Message); sw.WriteLine("StackTrace:"+ e.StackTrace); } sw.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)