ControllerBase.PhysicalFile 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
PhysicalFile(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)
physicalPath
傳回 (指定的 Status200OK 檔案) 、指定 contentType
為 Content-Type,以及指定 fileDownloadName
為建議的檔案名。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, System::String ^ fileDownloadName, Nullable<DateTimeOffset> lastModified, Microsoft::Net::Http::Headers::EntityTagHeaderValue ^ entityTag, bool enableRangeProcessing);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string fileDownloadName, DateTimeOffset? lastModified, Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag, bool enableRangeProcessing);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string? fileDownloadName, DateTimeOffset? lastModified, Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag, bool enableRangeProcessing);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, fileDownloadName As String, lastModified As Nullable(Of DateTimeOffset), entityTag As EntityTagHeaderValue, enableRangeProcessing As Boolean) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- fileDownloadName
- String
建議的檔案名。
- lastModified
- Nullable<DateTimeOffset>
DateTimeOffset上次修改檔案時的 。
- entityTag
- EntityTagHeaderValue
EntityTagHeaderValue與檔案相關聯的 。
- enableRangeProcessing
- Boolean
設定為 true
以啟用範圍要求處理。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)
physicalPath
傳回 (指定的 Status200OK 檔案) 、指定 contentType
為 Content-Type,以及指定 fileDownloadName
為建議的檔案名。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, System::String ^ fileDownloadName, Nullable<DateTimeOffset> lastModified, Microsoft::Net::Http::Headers::EntityTagHeaderValue ^ entityTag);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string fileDownloadName, DateTimeOffset? lastModified, Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string? fileDownloadName, DateTimeOffset? lastModified, Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, fileDownloadName As String, lastModified As Nullable(Of DateTimeOffset), entityTag As EntityTagHeaderValue) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- fileDownloadName
- String
建議的檔案名。
- lastModified
- Nullable<DateTimeOffset>
DateTimeOffset上次修改檔案時的 。
- entityTag
- EntityTagHeaderValue
EntityTagHeaderValue與檔案相關聯的 。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)
傳回 () Status200OK 所 physicalPath
指定的檔案,以及指定 contentType
為 Content-Type 的 。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, Nullable<DateTimeOffset> lastModified, Microsoft::Net::Http::Headers::EntityTagHeaderValue ^ entityTag, bool enableRangeProcessing);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, DateTimeOffset? lastModified, Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag, bool enableRangeProcessing);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, lastModified As Nullable(Of DateTimeOffset), entityTag As EntityTagHeaderValue, enableRangeProcessing As Boolean) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- lastModified
- Nullable<DateTimeOffset>
DateTimeOffset上次修改檔案時的 。
- entityTag
- EntityTagHeaderValue
EntityTagHeaderValue與檔案相關聯的 。
- enableRangeProcessing
- Boolean
設定為 true
以啟用範圍要求處理。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String, String, Boolean)
physicalPath
傳回 (指定的檔案 Status200OK ,) 指定 contentType
為 Content-Type,並將 指定 fileDownloadName
為建議的檔案名。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, System::String ^ fileDownloadName, bool enableRangeProcessing);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string fileDownloadName, bool enableRangeProcessing);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string? fileDownloadName, bool enableRangeProcessing);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * string * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * string * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, fileDownloadName As String, enableRangeProcessing As Boolean) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- fileDownloadName
- String
建議的檔案名。
- enableRangeProcessing
- Boolean
設定為 true
以啟用範圍要求處理。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String)
傳回指定為 Content-Type 的 (Status200OK) 所 physicalPath
指定的 contentType
檔案。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String, String)
physicalPath
傳回 (指定的檔案 Status200OK ,) 指定 contentType
為 Content-Type,並將 指定 fileDownloadName
為建議的檔案名。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, System::String ^ fileDownloadName);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string fileDownloadName);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, string? fileDownloadName);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * string -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * string -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, fileDownloadName As String) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- fileDownloadName
- String
建議的檔案名。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String, Boolean)
傳回指定為 Content-Type 的 (Status200OK) 所 physicalPath
指定的 contentType
檔案。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, bool enableRangeProcessing);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, bool enableRangeProcessing);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, enableRangeProcessing As Boolean) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- enableRangeProcessing
- Boolean
設定為 true
以啟用範圍要求處理。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
PhysicalFile(String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)
傳回 () Status200OK 所 physicalPath
指定的檔案,以及指定 contentType
為 Content-Type 的 。
這支援範圍要求 (Status206PartialContent ,或者 Status416RangeNotSatisfiable 範圍無法滿足) 。
public:
virtual Microsoft::AspNetCore::Mvc::PhysicalFileResult ^ PhysicalFile(System::String ^ physicalPath, System::String ^ contentType, Nullable<DateTimeOffset> lastModified, Microsoft::Net::Http::Headers::EntityTagHeaderValue ^ entityTag);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.PhysicalFileResult PhysicalFile (string physicalPath, string contentType, DateTimeOffset? lastModified, Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member PhysicalFile : string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
override this.PhysicalFile : string * string * Nullable<DateTimeOffset> * Microsoft.Net.Http.Headers.EntityTagHeaderValue -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, lastModified As Nullable(Of DateTimeOffset), entityTag As EntityTagHeaderValue) As PhysicalFileResult
參數
- physicalPath
- String
檔案的路徑。 路徑必須是絕對路徑。
- contentType
- String
檔案的 Content-Type。
- lastModified
- Nullable<DateTimeOffset>
DateTimeOffset上次修改檔案時的 。
- entityTag
- EntityTagHeaderValue
EntityTagHeaderValue與檔案相關聯的 。
傳回
為回應建立 PhysicalFileResult 的 。
- 屬性
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應