If I put the following code:
Response.ContentType = "image/jpeg"
Response.AppendHeader("Content-Disposition", "attachment; filename=capitol.jpg")
Response.WriteFile(MapPath("capitol.jpg"))
into Page_Load, I will get the dialog box to download the image. But when I put the same code into a sub routine:
Private Sub downloadPic()
MsgBox("Hello!")
Response.ContentType = "image/jpeg"
Response.AppendHeader("Content-Disposition", "attachment; filename=capitol.jpg")
Response.WriteFile(Server.MapPath("capitol.jpg"))
Response.End()
End Sub
I get the MsgBox (just for testing) but I don t get the ability to download the image. Any ideas?