FileStreamResult Class

Represents an Microsoft.AspNetCore.Mvc.ActionResult that when executed will write a file from a stream to the response.

Namespace
Microsoft.AspNetCore.Mvc
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

public class FileStreamResult : FileResult, IActionResult
class Microsoft.AspNetCore.Mvc.FileStreamResult

Constructors

FileStreamResult(System.IO.Stream, Microsoft.Net.Http.Headers.MediaTypeHeaderValue)

Creates a new Microsoft.AspNetCore.Mvc.FileStreamResult instance with the provided <em>fileStream</em> and the provided <em>contentType</em>.

Arguments:
public FileStreamResult(Stream fileStream, MediaTypeHeaderValue contentType)
FileStreamResult(System.IO.Stream, System.String)

Creates a new Microsoft.AspNetCore.Mvc.FileStreamResult instance with the provided <em>fileStream</em> and the provided <em>contentType</em>.

Arguments:
  • fileStream (System.IO.Stream) – The stream with the file.
  • contentType (System.String) – The Content-Type header of the response.
public FileStreamResult(Stream fileStream, string contentType)

Methods

ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext)
Return type:System.Threading.Tasks.Task
public override Task ExecuteResultAsync(ActionContext context)

Properties

Microsoft.AspNetCore.Mvc.FileStreamResult.FileStream

Gets or sets the stream with the file that will be sent back as the response.

Return type:System.IO.Stream
public Stream FileStream { get; set; }