In a previous post, “Tip - Use Constants For MIME Types”, we discussed how to use constants for MIME types, rather than the usual approach of specifying them as strings.

Thus, instead of doing this:

const string ApplicationJSON = "application/json";

You do this:

const string ApplicationJSON = MediaTypeNames.Application.Json;

This extends to other types of content:

One glaring omission is that video is not represented at all.

This is fixed in .NET 11 in the MediaTypeNames.Video class, which exposes the following constants:

TLDR

The MediaTypeNames.Video contains MIME constants for the major video formats.

Happy hacking!