Archive
Posts Tagged ‘download’
File Download code in vb.net
June 15, 2015
Leave a comment
If Not String.IsNullOrEmpty(strURL) Then
Dim req As New WebClient()
Dim response As HttpResponse = HttpContext.Current.Response
response.Clear()
response.ClearContent()
response.ClearHeaders()
response.Buffer = True
response.AddHeader(“Content-Disposition”, “attachment;filename=””” + Server.MapPath(strURL) + “”””)
Dim data As Byte() = req.DownloadData(Server.MapPath(strURL))
response.BinaryWrite(data)
response.[End]()
End If
Hope it helps !
Categories: ASP.NET
ASP.NET, C#, code, download, file download, on button click, vb.net
Comments