Prompt file download
<p>I have a link on my page on click of which I am trying to generate a PDF document and then show the "Open - Save" prompt on the browser.</p>

<p>My HTML (reactjs component) has the below code where <code>onclick</code> calls the <code>_getMyDocument</code> function which then calls a Webapi method.</p>

<pre><code> &lt;div className="row"&gt;
     &lt;a href="#" onClick={this._getMyDocument.bind(this)}&gt;Test Link&lt;/a&gt;
 &lt;/div&gt;  

_getMyDocument(e) {
            GetMyDocument(this.props.mydata).then(()=&gt; {
   }).catch(error=&gt; {

  });
</code></pre>

<p>My Controller has the below code </p>

<pre><code>[HttpPost]
[Route("Generate/Report")]
public IHttpActionResult GetMyReport(MyData myData)
 {  
    byte[] myDoc = MyBusinessObject.GenerateMyReport(myData);
    var result = new HttpResponseMessage(HttpStatusCode.OK)
        {
            Content = new ByteArrayContent(myDoc)
        };
        result.Content.Headers.ContentDisposition =
            new ContentDispositionHeaderValue("attachment")
            {
                FileName = "MyDocument.pdf"
            };
        result.Content.Headers.ContentType =
            new MediaTypeHeaderValue("application/octet-stream");

        var response = ResponseMessage(result);

        return response;
  }
</code></pre>

<p>Currently all the code executes but I don't get the file PDF download prompt. What am I doing wrong here?</p>

<p>Response object on success from the ajax call lokks like below</p>

<p><a href="https://i.stack.imgur.com/nZe6R.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nZe6R.png" alt="enter image description here"></a></p>