/// <summary> /// Handles the <see cref="E:Exception" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="T:System.UnhandledExceptionEventArgs" /> instance containing the event data.</param> protected override void OnException(object sender, UnhandledExceptionEventArgs e) { logger.LogError(e.ExceptionObject as Exception, "WebClientApi returned with an exception"); if (GlobalExtensions.IsWindows()) { System.Console.Beep(250, 200); } // e = errorCounter++ == 10 ? e = new UnhandledExceptionEventArgs(e.ExceptionObject, true) : e; base.OnException(sender, e); }
private void Jsonp(ActionContext context) { string __callback = context.HttpContext.Request.HasFormContentType ? context.HttpContext.Request.Form["__callback"].ToString() : null; if (string.IsNullOrEmpty(__callback)) { this.ContentType = "text/json;charset=utf-8;"; this.Content = JsonConvert.SerializeObject(this); } else { this.ContentType = "text/html;charset=utf-8"; this.Content = $"<script>top.{__callback}({GlobalExtensions.Json(null, this)});</script>"; } }