HttpResponse.TransmitFile HttpResponse.TransmitFile HttpResponse.TransmitFile HttpResponse.TransmitFile Method

定义

将指定的文件直接写入 HTTP 响应输出流,而不在内存中缓冲该文件。Writes the specified file directly to an HTTP response output stream without buffering it in memory.

重载

TransmitFile(String, Int64, Int64) TransmitFile(String, Int64, Int64) TransmitFile(String, Int64, Int64) TransmitFile(String, Int64, Int64)

将文件的指定部分直接写入 HTTP 响应输出流,而不在内存中缓冲它。Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.

TransmitFile(String) TransmitFile(String) TransmitFile(String) TransmitFile(String)

将指定的文件直接写入 HTTP 响应输出流,而不在内存中缓冲该文件。Writes the specified file directly to an HTTP response output stream, without buffering it in memory.

TransmitFile(String, Int64, Int64) TransmitFile(String, Int64, Int64) TransmitFile(String, Int64, Int64) TransmitFile(String, Int64, Int64)

将文件的指定部分直接写入 HTTP 响应输出流,而不在内存中缓冲它。Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.

public:
 void TransmitFile(System::String ^ filename, long offset, long length);
public void TransmitFile (string filename, long offset, long length);
member this.TransmitFile : string * int64 * int64 -> unit
Public Sub TransmitFile (filename As String, offset As Long, length As Long)

参数

filename
String String String String

要写入 HTTP 输出的文件名。The name of the file to write to the HTTP output.

offset
Int64 Int64 Int64 Int64

文件中的位置,将从该位置开始将内容写入到 HTTP 输出中。The position in the file to begin to write to the HTTP output.

length
Int64 Int64 Int64 Int64

要传输的字节数。The number of bytes to be transmitted.

异常

offset 参数小于零。The offset parameter is less than zero.

-or- length 参数小于 -1。The length parameter is less than -1.

-or- length 参数指定的字节数大于文件包含的字节数减去偏移值得到的数值。The length parameter specifies a number of bytes that is greater than the number of bytes the file contains minus the offset.

不支持进程外辅助请求。The out-of-process worker request is not supported.

-or- 响应不使用 HttpWriter 对象。The response is not using an HttpWriter object.

offset 参数小于零或大于文件大小。The offset parameter is less than zero or greater than the file size.

-or- length 参数小于 -1 或大于 offset 参数加上文件大小的值。The length parameter is less than -1 or greater than the value of the offset parameter plus the file size.

注解

如果将0指定为offset参数,并将-1 指定length为参数,则将发送整个文件。If you specify 0 as the offset parameter and -1 as the length parameter, the whole file is sent.

TransmitFile(String) TransmitFile(String) TransmitFile(String) TransmitFile(String)

将指定的文件直接写入 HTTP 响应输出流,而不在内存中缓冲该文件。Writes the specified file directly to an HTTP response output stream, without buffering it in memory.

public:
 void TransmitFile(System::String ^ filename);
public void TransmitFile (string filename);
member this.TransmitFile : string -> unit
Public Sub TransmitFile (filename As String)

参数

filename
String String String String

要写入 HTTP 输出的文件名。The name of the file to write to the HTTP output.

异常

filename 参数为 nullThe filename parameter is null

适用于