private static void ResponseWrite(HttpContext context, LibViewModel content) { HttpResponse response = context.Response; response.ContentType = "text"; response.Write(JsonHelper.Serialize(content)); HttpContext.Current.ApplicationInstance.CompleteRequest(); }
private static void ResponseException(Exception ex, HttpContext context, Func <Exception, string> exToString) { LibViewModel failure = LibViewModel.CreateFailureJSONResponseViewModel(LibViewModel.GetExceptionCode(ex), exToString(ex)); ResponseWrite(context, failure); }