Mime type bepalen van bestand

Install-Package Microsoft.AspNetCore.StaticFiles

in controller/class

public string Get(string fileName)
{
    var provider = new FileExtensionContentTypeProvider();
    string contentType;
    if(!provider.TryGetContentType(fileName, out contentType))
    {
        contentType = "application/octet-stream";
    }
    return contentType;
}

 

Categories:

Related Article