HttpResponseWrapper.WriteFile Method

Definition

Writes the specified file to the HTTP response output stream.

Overloads

WriteFile(IntPtr, Int64, Int64)

Writes the specified file to the HTTP response output stream.

WriteFile(String, Int64, Int64)

Writes the specified file to the HTTP response output stream.

WriteFile(String)

Writes the contents of the specified file to the HTTP response output stream as a file block.

WriteFile(String, Boolean)

Writes the contents of the specified file to the HTTP response output stream and specifies whether the content is written as a memory block.

WriteFile(IntPtr, Int64, Int64)

Writes the specified file to the HTTP response output stream.

C#
public override void WriteFile(IntPtr fileHandle, long offset, long size);

Parameters

fileHandle
IntPtr

The file handle of the file to write to the HTTP output stream.

offset
Int64

The position in the file where writing starts.

size
Int64

The number of bytes to write, starting at offset.

Exceptions

fileHandle is null.

offset is less than 0.

-or-

size is greater than the file size minus offset.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

WriteFile(String, Int64, Int64)

Writes the specified file to the HTTP response output stream.

C#
public override void WriteFile(string filename, long offset, long size);

Parameters

filename
String

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

offset
Int64

The position in the file where writing starts.

size
Int64

The number of bytes to write, starting at offset.

Exceptions

offset is less than 0.

-or-

size is greater than the file size minus offset.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

WriteFile(String)

Writes the contents of the specified file to the HTTP response output stream as a file block.

C#
public override void WriteFile(string filename);

Parameters

filename
String

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

Exceptions

The filename parameter is null.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

WriteFile(String, Boolean)

Writes the contents of the specified file to the HTTP response output stream and specifies whether the content is written as a memory block.

C#
public override void WriteFile(string filename, bool readIntoMemory);

Parameters

filename
String

The name of the file to write to the current response.

readIntoMemory
Boolean

true to write the file into a memory block.

Exceptions

The filename parameter is null.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1