title: How to retrieve HttpResponseMessage FileName in JavaScript
body: <p>I've this WebAPI method, that takes a custom object <code>MyType</code> as input and generate a PDF based on that. The PDF-file is returned as a <code>HttpResponseMessage</code>. Note that I specify the filename on <code>response.Content.Headers.ContentDisposition.FileName</code>:</p>
  
  <p><strong>ASP.NET WebAPI</strong></p>
  
  <pre><code>[Route("")]
  public HttpResponseMessage Get([FromUri]MyType input)
  {
      var pdfContent = PdfGenerator.Generate(input);
  
      var response = new HttpResponseMessage(HttpStatusCode.OK);
      response.Content = pdfContent;
      response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
      response.Content.Headers.ContentDisposition.FileName = "MyCustomFileName.pdf"
  
      return response;
  }
  </code></pre>
  
  <p>In AngularJS I fetch the file using <a href="https://github.com/eligrey/FileSaver.js/" rel="noreferrer">FileSaver.js</a> like this:</p>
  
  <pre><code>$http.get("api/pdf/", {
      params: {
          "type": myObject
      },
      responseType: 'arraybuffer'
  }).then(function (results) {
      var data = results.data;
  
      var file = new Blob([data], { type: 'application/pdf' });
      saveAs(file, 'filename.pdf');
  }, function (results) {
      console.log(results);
  });
  </code></pre>
  
  <p>It works as excepted, but I'm defining the filename both on WebAPI and in the JavaScript. Is there a way, that I can retrieve the FileName defined in WebAPI in the <code>results</code> variable in JavaScript?</p>