asp.net.ph

Response.WriteFile Method

System.Web Namespace   HttpResponse Class


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

Overload List

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

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

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

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


Example

The following example writes the entire contents of an .aspx file directly to the output stream.

NOTE: This example shows how to use one of the overloaded versions of WriteFile. For other examples that might be available, see the individual overload topics.

void Page_Load ( object sender, EventArgs e ) {

   // set the appropriate ContentType.
   Response.ContentType = "text/plain";

   // get the physical path to the file.
   string FilePath = Server.MapPath ( "~/shop/index.aspx" );

   // write the file directly to the HTTP content output stream.
   Response.WriteFile ( FilePath );
   Response.End ( );
}
  C# VB

 Show me 

See Also

HttpResponse Members Skip Navigation Links


Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note