<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-10-24 13:53 GMT+02:00 Etienne Champetier <span dir="ltr"><<a href="mailto:champetier.etienne@gmail.com" target="_blank">champetier.etienne@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I know nothing about customerrors,<br>but we are in the init so we may have fail to parse the config,<br>so using customerror here is dangerous<br><br><br><table><tbody><tr><td>                           Exception e = initialization_exception;</td>
    </tr>

    <tr>
        

        

      <td>                                HttpException exc = HttpException.NewWithCode (String.Empty, e, WebEventCodes.RuntimeErrorRequestAbort);</td>
    </tr>

    <tr>
        

        

      <td>+                               context.Response.StatusCode = 500;</td>
    </tr>

    <tr>
        

        

      <td>                                FinalErrorWrite (context.Response, exc.GetHtmlErrorMessage ());</td>
    </tr>

    <tr>
        

        

      <td>                                PipelineDone ();</td>
    </tr>

    <tr>
        

        

      <td>                                return;</td></tr></tbody></table><br><br><table><tbody><tr><td>             <span>static</span> <span>void</span> <span>FinalErrorWrite</span> <span>(</span><span>HttpResponse</span> <span>response</span><span>,</span> <span>string</span> <span>error</span><span>)</span></td>
      </tr>
      <tr>
        
        <td>              <span>{</span></td>
      </tr>
      <tr>
        
        <td>                      <span>try</span> <span>{</span></td>
      </tr>
      <tr>
        
        <td>                              <span>response</span><span>.</span><span>Write</span> <span>(</span><span>error</span><span>);</span></td>
      </tr>
      <tr>
        
        <td>                              <span>response</span><span>.</span><span>Flush</span> <span>(</span><span>true</span><span>);</span></td>
      </tr>
      <tr>
        
        <td>                      <span>}</span> <span>catch</span> <span>{</span></td>
      </tr>
      <tr>
        
        <td>                              <span>response</span><span>.</span><span>Close</span> <span>();</span></td>
      </tr>
      <tr>
        
        <td>                      <span>}</span></td>
      </tr>
      <tr>
        
        <td>              <span>}</span></td></tr></tbody></table><br><br></div>The only think that i'm sure of is that we are sending an exception with http 200 :)<br><div><br></div><div>I can replace 500 with exc.GetHttpCode() if you prefer?<br></div></div></blockquote><div><br></div><div>Forget about this, this will send 501 Not Implemented, i prefer 500<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><span class=""><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-10-24 13:33 GMT+02:00 Martin Thwaites <span dir="ltr"><<a href="mailto:martin@my2cents.co.uk" target="_blank">martin@my2cents.co.uk</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p dir="ltr">Does this need to take into account the customerrors setting in the Web.config or is that handled further down the pipeline?</p>
<div class="gmail_quote"><div><div>On 24 Oct 2014 09:57, "Etienne Champetier" <<a href="mailto:champetier.etienne@gmail.com" target="_blank">champetier.etienne@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div><div><div><div>Hi,<br><br></div>when we get an exception in InitOnce (in HttpApplication), we send this exception to the browser, without changing StatusCode so we get a wonderful http 200.<br><br></div>I've checked and it's the only place where we call FinalErrorWrite and we didn't set StatusCode.<br><br><a href="https://github.com/mono/mono/pull/1359" target="_blank">https://github.com/mono/mono/pull/1359</a><br><br></div>Bye<br></div>Etienne<br></div>
<br></div></div>
<br></blockquote></div>
</blockquote></div><br></div></span></div>
</blockquote></div><br></div></div>