Share via


PageBase.File 方法

定義

多載

File(Byte[], String)

傳回指定 fileContents 為內容 () Status200OK ,以及指定 contentType 為 Content-Type 的檔案。

File(Stream, String)

傳回指定 fileStream (Status200OK) 中指定 contentType 為 Content-Type 的檔案。

File(String, String)

傳回指定為 Content-Type 的 (Status200OK) 所 virtualPath 指定的 contentType 檔案。

File(Byte[], String, String)

傳回指定 fileContents 為內容 (Status200OK) 、指定 contentType 為 Content-Type 的檔案,以及指定 fileDownloadName 為建議的檔案名。

File(Stream, String, String)

傳回指定 fileStream () Status200OKcontentType 中指定為 Content-Type 的檔案,並將指定 fileDownloadName 為建議的檔案名。

File(String, String, String)

virtualPath傳回 (指定的檔案 Status200OK ,) 指定 contentType 為 Content-Type,並將 指定 fileDownloadName 為建議的檔案名。

File(Byte[], String)

來源:
PageBase.cs
來源:
PageBase.cs

傳回指定 fileContents 為內容 () Status200OK ,以及指定 contentType 為 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

參數

fileContents
Byte[]

檔案內容。

contentType
String

檔案的 Content-Type。

傳回

為回應建立 FileContentResult 的 。

適用於

File(Stream, String)

來源:
PageBase.cs
來源:
PageBase.cs

傳回指定 fileStream (Status200OK) 中指定 contentType 為 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

參數

fileStream
Stream

Stream具有檔案內容的 。

contentType
String

檔案的 Content-Type。

傳回

為回應建立 FileStreamResult 的 。

適用於

File(String, String)

來源:
PageBase.cs
來源:
PageBase.cs

傳回指定為 Content-Type 的 (Status200OK) 所 virtualPath 指定的 contentType 檔案。

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

參數

virtualPath
String

要傳回之檔案的虛擬路徑。

contentType
String

檔案的 Content-Type。

傳回

為回應建立 VirtualFileResult 的 。

適用於

File(Byte[], String, String)

來源:
PageBase.cs
來源:
PageBase.cs

傳回指定 fileContents 為內容 (Status200OK) 、指定 contentType 為 Content-Type 的檔案,以及指定 fileDownloadName 為建議的檔案名。

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

參數

fileContents
Byte[]

檔案內容。

contentType
String

檔案的 Content-Type。

fileDownloadName
String

建議的檔案名。

傳回

為回應建立 FileContentResult 的 。

適用於

File(Stream, String, String)

來源:
PageBase.cs
來源:
PageBase.cs

傳回指定 fileStream () Status200OKcontentType 中指定為 Content-Type 的檔案,並將指定 fileDownloadName 為建議的檔案名。

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

參數

fileStream
Stream

Stream具有檔案內容的 。

contentType
String

檔案的 Content-Type。

fileDownloadName
String

建議的檔案名。

傳回

為回應建立 FileStreamResult 的 。

適用於

File(String, String, String)

來源:
PageBase.cs
來源:
PageBase.cs

virtualPath傳回 (指定的檔案 Status200OK ,) 指定 contentType 為 Content-Type,並將 指定 fileDownloadName 為建議的檔案名。

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

參數

virtualPath
String

要傳回之檔案的虛擬路徑。

contentType
String

檔案的 Content-Type。

fileDownloadName
String

建議的檔案名。

傳回

為回應建立 VirtualFileResult 的 。

適用於