SendFileResponseExtensions Class

Provides extensions for HttpResponse exposing the SendFile extension.

Namespace
Microsoft.AspNetCore.Http
Assemblies
  • Microsoft.AspNetCore.Http.Extensions

Syntax

public class SendFileResponseExtensions
class Microsoft.AspNetCore.Http.SendFileResponseExtensions

Methods

SendFileAsync(Microsoft.AspNetCore.Http.HttpResponse, Microsoft.Extensions.FileProviders.IFileInfo, System.Int64, System.Nullable<System.Int64>, System.Threading.CancellationToken)

Sends the given file using the SendFile extension.

Arguments:
  • file (Microsoft.Extensions.FileProviders.IFileInfo) – The file.
  • offset (System.Int64) – The offset in the file.
  • count (System.Nullable<System.Int64>) – The number of bytes to send, or null to send the remainder of the file.
Return type:

System.Threading.Tasks.Task

public static Task SendFileAsync(this HttpResponse response, IFileInfo file, long offset, long ? count, CancellationToken cancellationToken = null)
SendFileAsync(Microsoft.AspNetCore.Http.HttpResponse, Microsoft.Extensions.FileProviders.IFileInfo, System.Threading.CancellationToken)

Sends the given file using the SendFile extension.

Arguments:
Return type:

System.Threading.Tasks.Task

public static Task SendFileAsync(this HttpResponse response, IFileInfo file, CancellationToken cancellationToken = null)
SendFileAsync(Microsoft.AspNetCore.Http.HttpResponse, System.String, System.Int64, System.Nullable<System.Int64>, System.Threading.CancellationToken)

Sends the given file using the SendFile extension.

Arguments:
  • fileName (System.String) – The full path to the file.
  • offset (System.Int64) – The offset in the file.
  • count (System.Nullable<System.Int64>) – The number of bytes to send, or null to send the remainder of the file.
Return type:

System.Threading.Tasks.Task

public static Task SendFileAsync(this HttpResponse response, string fileName, long offset, long ? count, CancellationToken cancellationToken = null)
SendFileAsync(Microsoft.AspNetCore.Http.HttpResponse, System.String, System.Threading.CancellationToken)

Sends the given file using the SendFile extension.

Arguments:
  • fileName (System.String) – The full path to the file.
  • cancellationToken (System.Threading.CancellationToken) – The System.Threading.CancellationToken.
Return type:

System.Threading.Tasks.Task

public static Task SendFileAsync(this HttpResponse response, string fileName, CancellationToken cancellationToken = null)