What are the valid content types for Controller.File()?

8k views Asked by At

I'm using MVC 4 in Visual Studio. I want to know how to create a file with the Controller.File() method. I understand I need to pass a file type. What are the valid file types? I'm not seeing this in the documentation (http://msdn.microsoft.com/en-us/library/dd492492(v=vs.108).aspx).

Example code:

return File(answers, "txt",filename);

Is there a list of content types that someone can reference me? I need to know format of the "txt" argument (or whatever I'm supposed to be putting there) basically (e.g. "txt" or ".txt" or "text/html" or "*.txt", etc.).

1

There are 1 answers

3
SLaks On BEST ANSWER

Those are mime types.
There are extensive lists of them all over the internet, including the official list from IANA.