public static void Log_Error_Admin(Exception ex, string message = null) { var logMessage = string.Empty; var stackTrace = string.Empty; if (ex != null) { logMessage = ex.Message; stackTrace = ex.StackTrace; } if (!string.IsNullOrWhiteSpace(message)) { if (!string.IsNullOrWhiteSpace(logMessage)) { logMessage += " :: "; } logMessage += message; } LogErrorsAdmin.Insert(DateTime.Now, UrlManager.GetCurrentPathUri(true).ToString(), logMessage, stackTrace); }