Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 1.1
.NET Framework
Reference
System.Web
HttpResponse Class
Methods
WriteFile Method
 WriteFile Method (String)

  Switch on low bandwidth view
.NET Framework Class Library
HttpResponse.WriteFile Method (String)

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

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker