PageModel.File 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
File(String, String, String) |
返回由 |
File(Stream, String, String) |
返回指定 |
File(Byte[], String, String) |
返回一个文件,其中指定 |
File(Stream, String) |
返回指定 |
File(Byte[], String) |
返回一个文件,其中指定 |
File(String, String) |
返回由 |
File(String, String, String)
- Source:
- PageModel.cs
- Source:
- PageModel.cs
- Source:
- PageModel.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 。
适用于
File(Stream, String, String)
- Source:
- PageModel.cs
- Source:
- PageModel.cs
- Source:
- PageModel.cs
返回指定 fileStream
(Status200OK) 的文件,指定的 contentType
作为 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
参数
- contentType
- String
文件的 Content-Type。
- fileDownloadName
- String
建议的文件名。
返回
为响应创建的 FileStreamResult 。
适用于
File(Byte[], String, String)
- Source:
- PageModel.cs
- Source:
- PageModel.cs
- Source:
- PageModel.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)
- Source:
- PageModel.cs
- Source:
- PageModel.cs
- Source:
- PageModel.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
参数
- contentType
- String
文件的 Content-Type。
返回
为响应创建的 FileStreamResult 。
适用于
File(Byte[], String)
- Source:
- PageModel.cs
- Source:
- PageModel.cs
- Source:
- PageModel.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(String, String)
- Source:
- PageModel.cs
- Source:
- PageModel.cs
- Source:
- PageModel.cs
返回由 virtualPath
(Status200OK) 指定的文件,并将 指定 contentType
为 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
参数
- virtualPath
- String
要返回的文件的虚拟路径。
- contentType
- String
文件的 Content-Type。
返回
为响应创建的 VirtualFileResult 。