FileResult Class¶
Summary¶
Represents an [Microsoft.AspNet.Mvc.ActionResult]() that when executed will write a file as the response.
Constructors¶
-
FileResult
(MediaTypeHeaderValue)¶ Creates a new [Microsoft.AspNet.Mvc.FileResult](Microsoft.AspNet.Mvc.FileResult.yml) instance with the provided <paramref name=”contentType” />.
Arguments: - contentType (MediaTypeHeaderValue) – The Content-Type header of the response.
protected FileResult(MediaTypeHeaderValue contentType)
-
FileResult
(System.String) Creates a new [Microsoft.AspNet.Mvc.FileResult](Microsoft.AspNet.Mvc.FileResult.yml) instance with the provided <paramref name=”contentType” />.
Arguments: - contentType (System.String) – The Content-Type header of the response.
protected FileResult(string contentType)
-
Properties¶
-
ContentType
()¶ Gets the @!:MediaTypeHeaderValue- representing the Content-Type header of the response.
Return type: MediaTypeHeaderValue public MediaTypeHeaderValue ContentType { get; }
-
FileDownloadName
()¶ Gets the file name that will be used in the Content-Disposition header of the response.
Return type: System.String public string FileDownloadName { get; set; }
-
Methods¶
-
ExecuteResultAsync
(Microsoft.AspNet.Mvc.ActionContext)¶ Arguments: - context (Microsoft.AspNet.Mvc.ActionContext) –
Return type: System.Threading.Tasks.Task
public override Task ExecuteResultAsync(ActionContext context)
-
WriteFileAsync
(HttpResponse, System.Threading.CancellationToken)¶ Writes the file to the response.
Arguments: - response (HttpResponse) – The @!:HttpResponse- where the file will be written
- cancellation (System.Threading.CancellationToken) – The [System.Threading.CancellationToken]()to cancel the operation.
Return type: System.Threading.Tasks.Task
Returns: A [System.Threading.Tasks.Task]() that will complete when the file has been written to the response.
protected abstract Task WriteFileAsync(HttpResponse response, CancellationToken cancellation)
-