File Download code in vb.net
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 (0)
Trackbacks (0)
Leave a comment
Trackback
Comments