title: Need to override Http Response Code from asmx web service
body: <p>My web sevices support flex/flash clients and, upon unhandeld exceptions, throw custom faults that extend System.ServiceModel.FaultException.</p>
  
  <p>I have been informed that flex/flash can't read these custom faults if the the http response code is different from 200.  This is documented as flex/flash bug: <a href="http://bugs.adobe.com/jira/browse/SDK-11841" rel="nofollow noreferrer">http://bugs.adobe.com/jira/browse/SDK-11841</a></p>
  
  <p>I need to override the http return code upon unhandled exceptions.  I have attempted to do this by including this code in global.asax (this hack has been documented as a work-around):</p>
  
  <pre><code>protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
  {
      if (Response.StatusCode != 200)
      { // fix response code for flex
          Response.StatusCode = 200;
      }
  }
  
  protected void Application_PreSendRequestHeaders(object sender, EventArgs e)
  {    
      if (Response.StatusCode != 200)    
      { // fix response code for flex        
           Response.StatusCode = 200;
       }
  }
  </code></pre>
  
  <p>But alas, my http return code comes back as 500 when an unhandled exception is encountered</p>
  
  <p>Any ideas?</p>