ASP.Net - Code For File Download

Here is a code that actually download a file for your website visitor:

Dim fst As New FileStream(Server.MapPath("abc.txt"), FileMode.Open)
Dim fi As String
fi = "abc.txt"

Dim bytBytes(fst.Length) As Byte
fst.Read(bytBytes, 0, fst.Length)

fst.Close()
Response.AddHeader("Content-disposition", "attachment; filename=" & fl)
Response.ContentType = "application/octet-stream"
Response.BinaryWrite(bytBytes)


Add comment Share
Hosting Companies insights
1404 Web Hosting Reviews A trusted source of genuine reviews. Learn Reviews
2628 Web Hosting Companies Ever-growing pool of web hosting providers. Browse Providers
2211 Web Hosting Coupons Exciting web hosting deals available here Browse Coupons