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




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

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

You can help support asp.net.ph