• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to Register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

How To Download File Code In ASP.Net?

Collapse

Unconfigured Ad Widget

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, 05:01 AM.
Working...
X

Sign up for a News Letter Click here to sign up