Share via


PageBase.File Method

Definition

Overloads

File(Byte[], String)

Returns a file with the specified fileContents as content (Status200OK) and the specified contentType as the Content-Type.

File(Stream, String)

Returns a file in the specified fileStream (Status200OK) with the specified contentType as the Content-Type.

File(String, String)

Returns the file specified by virtualPath (Status200OK) with the specified contentType as the Content-Type.

File(Byte[], String, String)

Returns a file with the specified fileContents as content (Status200OK), the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

File(Stream, String, String)

Returns a file in the specified fileStream (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

File(String, String, String)

Returns the file specified by virtualPath (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

File(Byte[], String)

Source:
PageBase.cs
Source:
PageBase.cs
Source:
PageBase.cs

Returns a file with the specified fileContents as content (Status200OK) and the specified contentType as the Content-Type.

public:
 virtual Microsoft::AspNetCore::Mvc::FileContentResult ^ File(cli::array <System::Byte> ^ fileContents, System::String ^ contentType);
public virtual Microsoft.AspNetCore.Mvc.FileContentResult File (byte[] fileContents, string contentType);
abstract member File : byte[] * string -> Microsoft.AspNetCore.Mvc.FileContentResult
override this.File : byte[] * string -> Microsoft.AspNetCore.Mvc.FileContentResult
Public Overridable Function File (fileContents As Byte(), contentType As String) As FileContentResult

Parameters

fileContents
Byte[]

The file contents.

contentType
String

The Content-Type of the file.

Returns

The created FileContentResult for the response.

Applies to

File(Stream, String)

Source:
PageBase.cs
Source:
PageBase.cs
Source:
PageBase.cs

Returns a file in the specified fileStream (Status200OK) with the specified contentType as the Content-Type.

public:
 virtual Microsoft::AspNetCore::Mvc::FileStreamResult ^ File(System::IO::Stream ^ fileStream, System::String ^ contentType);
public virtual Microsoft.AspNetCore.Mvc.FileStreamResult File (System.IO.Stream fileStream, string contentType);
abstract member File : System.IO.Stream * string -> Microsoft.AspNetCore.Mvc.FileStreamResult
override this.File : System.IO.Stream * string -> Microsoft.AspNetCore.Mvc.FileStreamResult
Public Overridable Function File (fileStream As Stream, contentType As String) As FileStreamResult

Parameters

fileStream
Stream

The Stream with the contents of the file.

contentType
String

The Content-Type of the file.

Returns

The created FileStreamResult for the response.

Applies to

File(String, String)

Source:
PageBase.cs
Source:
PageBase.cs
Source:
PageBase.cs

Returns the file specified by virtualPath (Status200OK) with the specified contentType as the Content-Type.

public:
 virtual Microsoft::AspNetCore::Mvc::VirtualFileResult ^ File(System::String ^ virtualPath, System::String ^ contentType);
public virtual Microsoft.AspNetCore.Mvc.VirtualFileResult File (string virtualPath, string contentType);
abstract member File : string * string -> Microsoft.AspNetCore.Mvc.VirtualFileResult
override this.File : string * string -> Microsoft.AspNetCore.Mvc.VirtualFileResult
Public Overridable Function File (virtualPath As String, contentType As String) As VirtualFileResult

Parameters

virtualPath
String

The virtual path of the file to be returned.

contentType
String

The Content-Type of the file.

Returns

The created VirtualFileResult for the response.

Applies to

File(Byte[], String, String)

Source:
PageBase.cs
Source:
PageBase.cs
Source:
PageBase.cs

Returns a file with the specified fileContents as content (Status200OK), the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

public:
 virtual Microsoft::AspNetCore::Mvc::FileContentResult ^ File(cli::array <System::Byte> ^ fileContents, System::String ^ contentType, System::String ^ fileDownloadName);
public virtual Microsoft.AspNetCore.Mvc.FileContentResult File (byte[] fileContents, string contentType, string fileDownloadName);
public virtual Microsoft.AspNetCore.Mvc.FileContentResult File (byte[] fileContents, string contentType, string? fileDownloadName);
abstract member File : byte[] * string * string -> Microsoft.AspNetCore.Mvc.FileContentResult
override this.File : byte[] * string * string -> Microsoft.AspNetCore.Mvc.FileContentResult
Public Overridable Function File (fileContents As Byte(), contentType As String, fileDownloadName As String) As FileContentResult

Parameters

fileContents
Byte[]

The file contents.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

Returns

The created FileContentResult for the response.

Applies to

File(Stream, String, String)

Source:
PageBase.cs
Source:
PageBase.cs
Source:
PageBase.cs

Returns a file in the specified fileStream (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

public:
 virtual Microsoft::AspNetCore::Mvc::FileStreamResult ^ File(System::IO::Stream ^ fileStream, System::String ^ contentType, System::String ^ fileDownloadName);
public virtual Microsoft.AspNetCore.Mvc.FileStreamResult File (System.IO.Stream fileStream, string contentType, string fileDownloadName);
public virtual Microsoft.AspNetCore.Mvc.FileStreamResult File (System.IO.Stream fileStream, string contentType, string? fileDownloadName);
abstract member File : System.IO.Stream * string * string -> Microsoft.AspNetCore.Mvc.FileStreamResult
override this.File : System.IO.Stream * string * string -> Microsoft.AspNetCore.Mvc.FileStreamResult
Public Overridable Function File (fileStream As Stream, contentType As String, fileDownloadName As String) As FileStreamResult

Parameters

fileStream
Stream

The Stream with the contents of the file.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

Returns

The created FileStreamResult for the response.

Applies to

File(String, String, String)

Source:
PageBase.cs
Source:
PageBase.cs
Source:
PageBase.cs

Returns the file specified by virtualPath (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

public:
 virtual Microsoft::AspNetCore::Mvc::VirtualFileResult ^ File(System::String ^ virtualPath, System::String ^ contentType, System::String ^ fileDownloadName);
public virtual Microsoft.AspNetCore.Mvc.VirtualFileResult File (string virtualPath, string contentType, string fileDownloadName);
public virtual Microsoft.AspNetCore.Mvc.VirtualFileResult File (string virtualPath, string contentType, string? fileDownloadName);
abstract member File : string * string * string -> Microsoft.AspNetCore.Mvc.VirtualFileResult
override this.File : string * string * string -> Microsoft.AspNetCore.Mvc.VirtualFileResult
Public Overridable Function File (virtualPath As String, contentType As String, fileDownloadName As String) As VirtualFileResult

Parameters

virtualPath
String

The virtual path of the file to be returned.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

Returns

The created VirtualFileResult for the response.

Applies to