Search code examples
htmlblazor-webassembly

Blazor WASM C# .NET 6 Content-Disposition is not Accessible


I'm extremely confused as I've been doing web development for many years now. Granted, this is my first time using Bazor and .NET 6.

Here's a screenshot of what I'm looking at:

enter image description here

Can someone please tell me why I can't get the content-disposition at all? This should be trivial, but I tried logging all of the headers on the response and I just don't see anything.

My API is returning a file using File(Stream fileStream, string contentType, string? fileDownloadName) and you can see the filename in the response header.


Solution

  • I finally figured it out. I wasn't able to get ANY header value until I updated my API CORS Policy as follows:

    enter image description here

    You must expose the headers. I'm not sure why you can see the headers in the response, but Blazor can't, but that's what you have to do.