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
);
- 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.
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 );
Dim FileName As String
Dim MyFileInfo As FileInfo
Dim StartPos, FileSize As Long
FileName = "c:\\temp\\login.txt"
MyFileInfo = New FileInfo ( FileName )
FileSize = MyFileInfo.Length
Response.Write ( "Please Login: <br>" )
Response.WriteFile ( FileName, StartPos, FileSize ) |
|
C# |
VB |
HttpResponse Members HttpResponse.WriteFile Overload List