System.Web Namespace HttpResponse Class
Writes the specified file directly to an HTTP content output stream.
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.
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 ( );
}
Sub Page_Load ( sender As Object, e As EventArgs )
' set the appropriate ContentType.
Response.ContentType = "text/plain"
' get the physical path to the file.
Dim FilePath As String = Server.MapPath ( "~/shop/index.aspx" )
' write the file directly to the HTTP content output stream.
Response.WriteFile ( FilePath )
Response.End ( )
End Sub |
|
C# |
VB |
Show me
HttpResponse Members