This documentation is archived and is not being maintained.

HttpResponse.WriteFile Method (String)

.NET Framework 1.1

Writes the specified file directly to an HTTP content output stream.

[Visual Basic]
Overloads Public Sub WriteFile( _
   ByVal filename As String _
)
[C#]
public void WriteFile(
 string filename
);
[C++]
public: void WriteFile(
 String* filename
);
[JScript]
public function WriteFile(
   filename : String
);

Parameters

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

Example

The following example writes the entire contents of a text file named "login.txt", (which might contain literal HTML text and input controls) directly to the output stream.

[Visual Basic] 
Response.Write("Please Login: <br>")
 Response.WriteFile("login.txt")
    

[C#] 
Response.Write("Please Login: <br>");
 Response.WriteFile("login.txt");
    

[C++] 
Response->Write(S"Please Login: <br>");
 Response->WriteFile(S"login.txt");
    

[JScript] 
Response.Write("Please Login: <br>")
Response.WriteFile("login.txt")

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpResponse Class | HttpResponse Members | System.Web Namespace | HttpResponse.WriteFile Overload List

Show: