Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

ControllerBase.PhysicalFile Method

Definition

Namespace:
Microsoft.AspNetCore.Mvc
Assembly:
Microsoft.AspNetCore.Mvc.Core.dll
Package:
Microsoft.AspNetCore.App.Ref v10.0.0-preview.5.25277.114
Package:
Microsoft.AspNetCore.Mvc.Core v2.1.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.2.0
Package:
Microsoft.AspNetCore.App.Ref v3.0.1
Package:
Microsoft.AspNetCore.App.Ref v3.1.10
Package:
Microsoft.AspNetCore.App.Ref v5.0.0
Package:
Microsoft.AspNetCore.App.Ref v6.0.6
Package:
Microsoft.AspNetCore.App.Ref v7.0.5
Package:
Microsoft.AspNetCore.App.Ref v8.0.0
Package:
Microsoft.AspNetCore.App.Ref v9.0.2
Package:
Microsoft.AspNetCore.Mvc.Core v2.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v1.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v1.1.0

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

PhysicalFile(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Returns the file specified byphysicalPath (Status200OK), thespecifiedcontentType as the Content-Type, and the specifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Returns the file specified byphysicalPath (Status200OK), thespecifiedcontentType as the Content-Type, and the specifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Returns the file specified byphysicalPath (Status200OK), andthe specifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, String, Boolean)

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type and thespecifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, Boolean)

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, String)

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type and thespecifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Returns the file specified byphysicalPath (Status200OK), andthe specifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String)

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

PhysicalFile(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK), thespecifiedcontentType as the Content-Type, and the specifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride 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

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

lastModified
Nullable<DateTimeOffset>

TheDateTimeOffset of when the file was last modified.

entityTag
EntityTagHeaderValue

TheEntityTagHeaderValue associated with the file.

enableRangeProcessing
Boolean

Set totrue to enable range requests processing.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK), thespecifiedcontentType as the Content-Type, and the specifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride 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

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

lastModified
Nullable<DateTimeOffset>

TheDateTimeOffset of when the file was last modified.

entityTag
EntityTagHeaderValue

TheEntityTagHeaderValue associated with the file.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue, Boolean)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK), andthe specifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride 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

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

lastModified
Nullable<DateTimeOffset>

TheDateTimeOffset of when the file was last modified.

entityTag
EntityTagHeaderValue

TheEntityTagHeaderValue associated with the file.

enableRangeProcessing
Boolean

Set totrue to enable range requests processing.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String, String, Boolean)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type and thespecifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride 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

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

enableRangeProcessing
Boolean

Set totrue to enable range requests processing.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String, Boolean)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride this.PhysicalFile : string * string * bool -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, enableRangeProcessing As Boolean) As PhysicalFileResult

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

enableRangeProcessing
Boolean

Set totrue to enable range requests processing.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String, String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type and thespecifiedfileDownloadName as the suggested file name.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride this.PhysicalFile : string * string * string -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String, fileDownloadName As String) As PhysicalFileResult

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

fileDownloadName
String

The suggested file name.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String, Nullable<DateTimeOffset>, EntityTagHeaderValue)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK), andthe specifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride 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

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

lastModified
Nullable<DateTimeOffset>

TheDateTimeOffset of when the file was last modified.

entityTag
EntityTagHeaderValue

TheEntityTagHeaderValue associated with the file.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to

PhysicalFile(String, String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

Returns the file specified byphysicalPath (Status200OK) with thespecifiedcontentType as the Content-Type.This supports range requests (Status206PartialContent orStatus416RangeNotSatisfiable if the range is not satisfiable).

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.PhysicalFileResultoverride this.PhysicalFile : string * string -> Microsoft.AspNetCore.Mvc.PhysicalFileResult
Public Overridable Function PhysicalFile (physicalPath As String, contentType As String) As PhysicalFileResult

Parameters

physicalPath
String

The path to the file. The path must be an absolute path.

contentType
String

The Content-Type of the file.

Returns

The createdPhysicalFileResult for the response.

Attributes

Applies to


Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo