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)
返回由 physicalPath
(Status200OK) 指定的文件,以及指定 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)
返回由 physicalPath
(Status200OK) 指定的文件,并将 指定 contentType
为 Content-Type。
如果范围) 不满意, 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)
返回由 physicalPath
(Status200OK) 指定的文件,并将 指定 contentType
为 Content-Type。
如果范围) 不满意, 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)
返回由 physicalPath
(Status200OK) 指定的文件,以及指定 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 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈