title: HttpContext.Current.Response.AddHeader() not setting Content-Type header
body: <p>I'm using third-party software to render PDFs from html documents. I created a small test project and using the <code>OnClick</code> event of an <code>&lt;asp:Button&gt;</code> I was able to read a html document from a directory and render it as a PDF with no problems.</p>
  <p>The response is created as follows:</p>
  <pre><code>HttpContext.Current.Response.Clear();
  HttpContext.Current.Response.AddHeader(&quot;Content-Type&quot;, &quot;application/pdf&quot;);
  HttpContext.Current.Response.AddHeader(&quot;Content-Disposition&quot;, 
      String.Format(&quot;{0}; filename=Test.pdf;&quot;, &quot;inline&quot; ));
  HttpContext.Current.Response.BinaryWrite(pdfBuffer);
  HttpContext.Current.ApplicationInstance.CompleteRequest();
  </code></pre>
  <p>When I look at the response in Chrome, I can see that Content-Type is being set correctly:</p>
  <blockquote>
  <p>Content-Disposition:inline; filename=HtmlToPdf.pdf;</p>
  <p>Content-Length:101482</p>
  <p>Content-Type:application/pdf</p>
  </blockquote>
  <p>I've tried to transfer the above to my current project. The only difference being that instead of one <code>&lt;asp:Button&gt;</code> I'm using a custom button inside a DevExpress grid view. I Initially handled the custom button click in a callback panel, but Content-Type was not being set. Viewing the response in Chrome proved this:</p>
  <blockquote>
  <p>Content-Disposition:inline; filename=5.pdf;</p>
  <p>Content-Encoding:gzip</p>
  <p>Content-Length:149015</p>
  <p>Content-Type:text/plain; charset=utf-8</p>
  </blockquote>
  <p>I've also tried using the <code>gvDocuments.CustomButtonCallback += new ASPxGridViewCustomButtonCallbackEventHandler(gvDocuments_CustomButtonCallback);</code> event but Content-Type is still not being set.</p>
  <p>Anyone have any ideas as to why I cannot set Content-Type in the above scenario?</p>