0
votes

I'm creating Blazor Webassembly app, which call my Dotnet web API. I'm using the injected http client, and the api call itself run without problems, Postmann & WireShark confirms that my custom response headers from the API is returned correctly. But in the Blazor Webassembly app, there is only one header "content-type". I know that the Blazor Http client is a wrapper around some Javascript, but are there anyone out there that can help with some knowledge or examples on how to get custom response headers thru to the Blazor app. I'm using Visual Studio 2019 Community and also Visual Studio Code, and normally I develop on a Mac, but due to problems with debugging Blazor apps on Mac I changed to Windows 10.

1

1 Answers

0
votes

It was actually very simple. To allow my custom response headers to be available in a Blazor Webassembly app, On the server API, just add below header to the response:

HttpContext.Response.Headers.Add(" Access-Control-Expose-Headers","YourCustomHeader,YourOtherCustomHeader");