title: Unable to save Excel file from server
body: <p>I generate an Excel file using the Aspose library in .NET and the controller returns this:</p>
  
  <pre><code>public async Task&lt;IActionResult&gt; GetFile()
  {
    byte[] bytes = null;    
    await Task.Run(() =&gt; bytes = GetBytes());    
    return new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
    {
      FileDownloadName = "Template.xlsx"
    };
  }
  </code></pre>
  
  <p>On the React front I send the request like this from redux</p>
  
  <pre><code>dispatch({
    [CALL_API]: {
      method: HttpMethod.GET,
      types: [
        types.GET_FILE_REQUEST,
        types.GET_FILE_SUCCESS,
        types.GET_FILE_ERROR,
      ],
      endpoint: `getFile`,
      useLoader: true,
      responseType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
    },
  }).then((action) =&gt; {
    if (!action.error) {
      download({
        name: fileName,
        data: action.response,
        type: action.response.type,
      });
    }
  });
  </code></pre>
  
  <p>I receive an error whose message is "Unexpected token P in JSON at position 0". On the server I tried saving the file and checked its validity on disk, it is fine. I also changed the response type values on the front and back but the result was always the same. </p>
  
  <p><a href="https://i.stack.imgur.com/uTZTJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uTZTJ.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/vW1ne.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vW1ne.png" alt="enter image description here"></a></p>
  
  <p>Any ideas where the flaw is?</p>