An unhandled exception occurred while processing the request: FormatException: The header contains invalid values at index 0

Question: An unhandled exception occurred while processing the request: FormatException: The header contains invalid values at index 0: '<null>'
Why am I receiving this error in MVC AspNet 6 using Visual Studio 2022?


Please Login to see the rest of the answer

Answer: This error seems to be the result of passing a null contentType (content-type) in a PhysicalFile() function. The PhysicalFile() function does not determine what content type it is to return to the caller. Make sure that the content type is actually valid before returning to the Function Caller.


[Note]: Did you know you could edit this article? make sure you log in so that you can get credits.




Write an Article
If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2022 - ErnesTech - Privacy