asp.net.ph

Response.WriteFile Method ( String, Int64, Int64 )

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, _
   ByVal offset As Long, _
   ByVal size As Long _
)

[ C# ]
public void WriteFile (
   string filename,
   long offset,
   long size
);

[ C++ ]
public: void WriteFile (
   String* filename,
   __int64 offset,
   __int64 size
);

[ JScript ]
public function WriteFile (
   filename : String,
   offset : long,
   size : long
);

Parameters

filename
The name of the file to write to the HTTP output stream.
offset
The byte position in the file where writing will start.
size
The number of bytes to write to the output stream.

Example

The following example writes the entire contents of a text file named "login.txt" ( which might contain literal text and HTML input controls ) directly to the output stream.

String FileName;
FileInfo MyFileInfo;
long StartPos = 0, FileSize;

FileName = "c:\\temp\\login.txt";
MyFileInfo = new FileInfo ( FileName );
FileSize = MyFileInfo.Length;

Response.Write ( "Please Login: <br>" );
Response.WriteFile ( FileName, StartPos, FileSize );
  C# VB

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