VirtualFileResult Class¶
A Microsoft.AspNetCore.Mvc.FileResult that on execution writes the file specified using a virtual path to the response
using mechanisms provided by the host.
- Namespace
Microsoft.AspNetCore.Mvc- Assemblies
- Microsoft.AspNetCore.Mvc.Core
Syntax¶
public class VirtualFileResult : FileResult, IActionResult
-
class
Microsoft.AspNetCore.Mvc.VirtualFileResult
Constructors¶
-
VirtualFileResult(System.String, Microsoft.Net.Http.Headers.MediaTypeHeaderValue)¶ Creates a new
Microsoft.AspNetCore.Mvc.VirtualFileResultinstance with the provided <em>fileName</em> and the provided <em>contentType</em>.Arguments: - fileName (System.String) – The path to the file. The path must be relative/virtual.
- contentType (Microsoft.Net.Http.Headers.MediaTypeHeaderValue) – The Content-Type header of the response.
public VirtualFileResult(string fileName, MediaTypeHeaderValue contentType)
-
VirtualFileResult(System.String, System.String) Creates a new
Microsoft.AspNetCore.Mvc.VirtualFileResultinstance with the provided <em>fileName</em> and the provided <em>contentType</em>.Arguments: - fileName (System.String) – The path to the file. The path must be relative/virtual.
- contentType (System.String) – The Content-Type header of the response.
public VirtualFileResult(string fileName, string contentType)
-
Methods¶
-
ExecuteResultAsync(Microsoft.AspNetCore.Mvc.ActionContext)¶ Return type: System.Threading.Tasks.Task public override Task ExecuteResultAsync(ActionContext context)
-
Properties¶
-
Microsoft.AspNetCore.Mvc.VirtualFileResult.FileName¶ Gets or sets the path to the file that will be sent back as the response.
Return type: System.String public string FileName { get; set; }
-
Microsoft.AspNetCore.Mvc.VirtualFileResult.FileProvider¶ Gets or sets the
Microsoft.Extensions.FileProviders.IFileProviderused to resolve paths.Return type: Microsoft.Extensions.FileProviders.IFileProvider public IFileProvider FileProvider { get; set; }
-