Upraviť

Zdieľať cez


HttpResponse.TransmitFile Method

Definition

Writes the specified file directly to an HTTP response output stream without buffering it in memory.

Overloads

TransmitFile(String, Int64, Int64)

Writes the specified part of a file directly to an HTTP response output stream without buffering it in memory.

TransmitFile(String)

Writes the specified file directly to an HTTP response output stream, without buffering it in memory.

TransmitFile(String, Int64, Int64)

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)

Parameters

filename
String

The name of the file to write to the HTTP output.

offset
Int64

The position in the file to begin to write to the HTTP output.

length
Int64

The number of bytes to be transmitted.

Exceptions

The offset parameter is less than zero.

-or-

The length parameter is less than -1.

-or-

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-

The response is not using an HttpWriter object.

The offset parameter is less than zero or greater than the file size.

-or-

The length parameter is less than -1 or greater than the value of the offset parameter plus the file size.

Remarks

If you specify 0 as the offset parameter and -1 as the length parameter, the whole file is sent.

Applies to

TransmitFile(String)

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)

Parameters

filename
String

The name of the file to write to the HTTP output.

Exceptions

The filename parameter is null

Applies to