How will I get the Mime Type or Content Type of a Specific file through its file extension? This program is developed in MVC3 Razor Syntax, the code looks like this:
if (System.IO.File.Exists(file))
return File(file, "application/pdf", id);
else
return RedirectToAction("Index");
I want to change the application/pdf to a dynamic value such that it would supply the MIME type through the id or the filename that is sent to the controller.