Ejemplo n.º 1
0
 /// <summary>
 /// End a ServiceStack Request
 /// </summary>
 public static void EndRequest(this HttpResponseBase httpRes, bool skipHeaders = false)
 {
     if (!skipHeaders)
     {
         httpRes.ApplyGlobalResponseHeaders();
     }
     httpRes.Close();
     HostContext.CompleteRequest(null);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// End a HttpHandler Request
        /// </summary>
        public static void EndHttpHandlerRequest(this HttpResponseBase httpRes, bool skipHeaders = false, bool skipClose = false, bool closeOutputStream = false, Action <HttpResponseBase> afterHeaders = null)
        {
            if (!skipHeaders)
            {
                httpRes.ApplyGlobalResponseHeaders();
            }
            if (afterHeaders != null)
            {
                afterHeaders(httpRes);
            }
            if (closeOutputStream)
            {
                httpRes.CloseOutputStream();
            }
            else if (!skipClose)
            {
                httpRes.Close();
            }

            //skipHeaders used when Apache+mod_mono doesn't like:
            //response.OutputStream.Flush();
            //response.Close();
        }