Initiate download using ASP.NET
Sample code on how to initiate the download of a local server file through the Internet, using ASP.NET and its FileStream object. This code is written in C# but can be easily converted to VB.NET.
|
On Wednesday, March 19th 2008 at 10:12 PM By Andrei Pociu (View Profile)
    (Rated 0 with 0 votes) |
Contextual Ads
More ASP.NET Resources
Advertisement
FileStream fStream = new FileStream (@"C:\TheOrchid.zip", FileMode. Open, FileAccess. Read);
byte[] byteBuffer = new byte[(int)fStream. Length];
fStream.Read(byteBuffer, 0, (int)fStream.Length);
fStream.Close();
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Length", byteBuffer.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=ThePearl.zip");
Response.BinaryWrite(byteBuffer);
Response.End();
|
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|
Rate this code snippet
Current Comments
|
Related Source Code
There is no related code.
Related Tutorials
There are no related tutorials.
ASP.NET Job Search
|