TypedResults.VirtualFile Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes the file at the specified path
to the response.
This supports range requests (Status206PartialContent or Status416RangeNotSatisfiable if the range is not satisfiable).
public static Microsoft.AspNetCore.Http.HttpResults.VirtualFileHttpResult VirtualFile (string path, string? contentType = default, string? fileDownloadName = default, DateTimeOffset? lastModified = default, Microsoft.Net.Http.Headers.EntityTagHeaderValue? entityTag = default, bool enableRangeProcessing = false);
static member VirtualFile : string * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Http.HttpResults.VirtualFileHttpResult
Public Shared Function VirtualFile (path As String, Optional contentType As String = Nothing, Optional fileDownloadName As String = Nothing, Optional lastModified As Nullable(Of DateTimeOffset) = Nothing, Optional entityTag As EntityTagHeaderValue = Nothing, Optional enableRangeProcessing As Boolean = false) As VirtualFileHttpResult
Parameters
- path
- String
The path to the file. When not rooted, resolves the path relative to WebRootFileProvider.
- contentType
- String
The Content-Type of the file.
- fileDownloadName
- String
The suggested file name.
- lastModified
- Nullable<DateTimeOffset>
The DateTimeOffset of when the file was last modified.
- entityTag
- EntityTagHeaderValue
The EntityTagHeaderValue associated with the file.
- enableRangeProcessing
- Boolean
Set to true
to enable range requests processing.
Returns
The created VirtualFileHttpResult for the response.