Announcement

Collapse
No announcement yet.

How To Download File Code In ASP.Net?

Collapse

Ads on showthread pages

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How To Download File Code In ASP.Net?

    WordPress Hosting on SSD Servers
    One can use below mentioned ASP.Net code upon the requirement to download file:

    Dim fst As New FileStream(Server.MapPath("abc.txt"), FileMode.Open)
    Dim fl As String
    if = "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)
    Last edited by admin; 08-21-2015, 06:01 AM.
Working...
X
Sign up for a News Letter Click here to sign up