File Not download in Asp.Net Core 2.0 + Angullar 4
Calling From Angular 4
...
let header = new Headers({ 'Content-Type': 'application/json' });
this.http.post(this.url + 'GeneratePdf', this.responseModel, { headers: header })
.subscribe(values => {
console.log(values);
});
Asp.Net Core 2.0 API
[HttpPost]
public IActionResult GeneratePdf([FromBody]ResponseModel objResponse)
{
....
byte[] bytes = memoryStream.ToArray();
memoryStream.Close();
var result = new FileContentResult(bytes, "application/pdf")
{
FileDownloadName = $"HashFiles.pdf"
};
return result;
}
File not download when i call the API from Angular but in postman working fine.