Dynamically setting Content Type in ASP.NET Core with FileExtensionContentTypeProvider

added by DotNetKicks
2/25/2019 4:51:46 PM

91 Views

tldr; If you have a scenario where you have multiple file types (.pdf, .docx, etc.) stored somewhere (in a database, file system, etc.), that need to be downloaded, you can automatically figure out the Content Type by newing up a FileExtensionContentTypeProvider and call TryGetContentType to get the Content Type and pass that to the Fileresult...


0 comments