asp.net.ph

Response.WriteFile Method ( String )

System.Web Namespace   HttpResponse Class


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

[ VB ]
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 an .aspx file directly to the output stream.

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   HttpResponse.WriteFile Overload List 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