Controller.File Method (String, String)
Visual Studio 2010
Creates a FilePathResult object by using the file name and the content type.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Parameters
- fileName
- Type: System.String
The path of the file to send to the response.
- contentType
- Type: System.String
The content type (MIME type).
A Visual Studio project with source code is available to accompany this topic: Download.
The following example shows how to send an HTML file to the browser. The id parameter contains the server file name.
Community Additions
ADD
Show: