asp.net.ph

Response.WriteFile Method ( IntPtr, Int64, Int64 )

System.Web Namespace   HttpResponse Class


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

[ VB ]
Overloads Public Sub WriteFile ( _
   ByVal fileHandle As IntPtr, _
   ByVal offset As Long, _
   ByVal size As Long _
)

[ C# ]
public void WriteFile (
   IntPtr fileHandle,
   long offset,
   long size
);

[ C++ ]
public: void WriteFile (
   IntPtr fileHandle,
   __int64 offset,
   __int64 size
);

[ JScript ]
public function WriteFile (
   fileHandle : IntPtr,
   offset : long,
   size : long
);

Parameters

fileHandle
The file handle 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 HTML text and input controls ) directly to the output stream.

String FileName;
FileStream MyFileStream;
IntPtr FileHandle;
long StartPos = 0, FileSize;
 
FileName = "c:\\temp\\Login.txt";
 
MyFileStream = new FileStream ( FileName, FileMode.Open );
FileHandle = MyFileStream.Handle;
FileSize = MyFileStream.Length;
 
Response.Write ( "<b>Login: </b>" );
Response.Write ( "<input type=text id=user /> " );
Response.Write ( "<input type=submit value=Submit /><br><br>" );
 
Response.WriteFile ( FileHandle, StartPos, FileSize );
    
MyFileStream.Close ( );
  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