Пример #1
0
        public IActionResult Error()
        {
            var exceptionData = HttpContext.Features.Get <IExceptionHandlerPathFeature>();

            if (exceptionData != null)
            {
                var exception = exceptionData.Error;
                LoggerController.AddExceptionLog(this.GetType().Name, exception);
                EmailSender smc = new EmailSender();
                smc.IsHtmlBody = false;
                smc.SendEmailAsync("*****@*****.**", SettingsController.AppName.Name + " - Error", "" +
                                   "Wiadomość błędu: " + exception.Message + "\nStos wyjątku: " +
                                   exception.StackTrace + "\nWyjątek: " + exception.InnerException);
            }
            return(View(new ErrorViewModel {
                RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
            }));
        }