I have this code on a page with a querystring of filename. I'm trying to download text file with this text:
hiuhidgklhg
But using this code to download:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.QueryString("filename") <> "" Then
Dim filename As String = Request.QueryString("filename").ToString()
Dim filepath As String = Server.MapPath(IO.Path.Combine("~/App_Data", filename))
With Response
.Clear()
.ContentType = "application/octet-stream"
.AddHeader("Content-Disposition", "attachment; filename=" & filename)
.Flush()
.WriteFile(filepath)
End With
Else
MsgBox("No filename parameter.", MsgBoxStyle.Information, "Info")
End If
End Sub
it gives me this:
...
Go to the complete details ...