0

I've got an aspnet core API working well.

My frontend application has no problem with consuming simple datas from API.

But I've got a 403 error when I call an endpoint that returns a 'txt' file. It occurs just only return a FileContentResult. The 403 error generates an exception in my frontend, and the result that I expect comes inside error.response.data property. What a crazy thing!

The same endpoint returns 200 if I change the return from FileContentResult to Ok(), but obviously is not what I want.

Someone can help me ?

Yki_Summer
  • 27
  • 1
  • 8
  • 1
    How are we supposed to help with your code if you dont post your code? –  Dec 20 '19 at 15:57
  • Did u look into this :) https://stackoverflow.com/questions/11125535/how-to-return-a-file-using-web-api – Indunil Withana Dec 20 '19 at 16:02
  • thx for replies. @IndunilWithana I've tried that approach but it doesn't work. I'm not using file path, but I'm creating a stream of data and transforming to bytes. So I'm returning `File(bytes,'application/octet-stream','myFileName.txt')` If I find the solution I post here. – Yki_Summer Dec 20 '19 at 16:12

0 Answers0