HttpResponseBase.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 virtual 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

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 virtual 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

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 virtual void WriteFile(string filename);

Parameters

filename
String

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

Exceptions

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 virtual 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

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