Posted on: 9/3/2015 7:51:25 PM | Views : 750

Hi All,
I am trying to download the text files. I have the following code on my web page:
Protected Function downloadfile(ByVal filepath As String) As Boolean Dim ReturnResults As Boolean = False Dim iStream As System.IO.Stream = Nothing Dim buffer As Byte() = New [Byte](ByteSize) {} Dim length As Integer Dim dataToRead As Long Dim filename As String = System.IO.Path.GetFileName(filepath) Try iStream = New System.IO.FileStream(filepath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read) dataToRead = iStream.Length Response.Clear() Response.ContentType = "application/octet-stream" Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", filename.Replace(" ", ""))) ...

Go to the complete details ...