public void Render(HtmlTextWriter writer) { if (_isAutomatedTool) { var console = new StringProgressStatus(); ProcessInternal(console); HttpContext.Current.Response.ContentType = "text/plain"; HttpContext.Current.Response.Write(Title + "\n\n"); HttpContext.Current.Response.Write(console.Output); if (console.HasErrors) { HttpContext.Current.Response.StatusCode = 500; HttpContext.Current.Response.TrySkipIisCustomErrors = true; } HttpContext.Current.Response.End(); } else { var console = new CustomStyledHtml5WebConsole(HttpContext.Current.Response); console.Title = Title; console.Render(ProcessInternal); } }
public virtual void Execute(HttpResponseBase response) { if (_isAutomatedTool) { var console = new UnicornStringConsole(); ProcessInternal(console); response.ContentType = "text/plain"; response.Write(_title + "\n\n"); response.Write(console.Output); if (console.HasErrors) { response.StatusCode = 500; response.TrySkipIisCustomErrors = true; } response.End(); } else { var console = new CustomStyledHtml5WebConsole(response); console.Title = _title; console.Render(ProcessInternal); } }
public virtual void Execute(HttpResponseBase response) { if (_isAutomatedTool) { var console = new TextWebConsole(response); console.WriteLine(_title + "\n\n"); try { console.Render(ProcessInternal); } catch (Exception ex) { // writing the exception will also trigger HasErrors console.WriteException(ex); } if (console.HasErrors) { // we cannot return HTTP 500 because headers will have already been sent by now response.Write("****ERROR OCCURRED****"); } response.End(); } else { var console = new CustomStyledHtml5WebConsole(response); console.Title = _title; console.Render(ProcessInternal); } }