Table of Contents


MimeContentTypes

This class allows you to access standard MIME type in your program. Supported MIME types are:

PropertyDescription
CsvReturns "text/csv"
ExcelReturns "application/vnd.ms-excel"
FormReturns "application/x-www-form-urlencoded"
HtmlReturns "text/html"
Image_PngReturns "image/png"
Image_GifReturns "image/gif"
Image_JpgReturns "image/jpeg"
JavascriptReturns "application/javascript"
JsonReturns "application/json"
PdfReturns "application/pdf"
TextReturns "text/plain"
UnknownReturns "application/octet-stream"
Word (doc)Returns "application/ms-word"
Word (docx)Returns "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
XmlReturns "application/xml"
XmlTextReturns "application/xml; encoding='utf-8'"

 

An example of passing MIME type to "File" response is below: 

public ActionResponse Index()
{
    byte[] fileContents = PdfGenerator.Generate("<h1>Hello World</h1>");
    return File(fileContents, MimeContentTypes.Pdf);
}