IContentTypeProvider Interface

Used to look up MIME types given a file path

Namespace
Microsoft.AspNetCore.StaticFiles
Assemblies
  • Microsoft.AspNetCore.StaticFiles

Syntax

public interface IContentTypeProvider
interface Microsoft.AspNetCore.StaticFiles.IContentTypeProvider

Methods

TryGetContentType(System.String, out System.String)

Given a file path, determine the MIME type

Arguments:
  • subpath (System.String) – A file path
  • contentType (System.String) – The resulting MIME type
Return type:

System.Boolean

Returns:

True if MIME type could be determined

bool TryGetContentType(string subpath, out string contentType)