Configuring the available MIME types

ASP.Net Core serves static files that are of a known MIME type. A MIME type is an identifier of the type of content that a specific file holds. For example, HTML files have a MIME type of text/html, and JPEG image files have a MIME type of image/jpeg.

When a web server serves a file, it attaches its MIME type to the response as an HTTP header named content-type. The browser then, in turn, uses this MIME type to decide on how to interpret the file.

ASP.NET Core recognizes almost 400 mime types automatically. When it runs into an unrecognized file, it will not serve it to the end user and instead return a 404 — Not Found response. This behavior improves the security of your web application and works in the ...

Get Hands-On Full-Stack Web Development with ASP.NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.