Export (0) Print
Expand All

HttpResponse.WriteFile Method (String, Boolean)

Writes the contents of the specified file into a memory block.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public void WriteFile (
	string filename,
	bool readIntoMemory
)
public void WriteFile (
	String filename, 
	boolean readIntoMemory
)
public function WriteFile (
	filename : String, 
	readIntoMemory : boolean
)
Not applicable.

Parameters

filename

The name of the file to write into a memory block.

readIntoMemory

Indicates whether the file will be written into a memory block.

Exception typeCondition

ArgumentNullException

filename is a null reference (Nothing in Visual Basic).

When this method is used with large files, calling the method might result in an exception. The size of the file that can be used with this method depends on the hardware configuration of the Web server. For more information, see article 812406, "PRB: Response.WriteFile Cannot Download a Large File" in the Microsoft Knowledge Base.

The following example writes a file to memory.

Response.WriteFile("login.txt", true);
    

get_Response().WriteFile("login.txt", true);

Response.WriteFile("login.txt", true)
    

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft