Caute, nevie mi niekto poradit s tymto problemom? Mam na servri v Asp.Net stranku, pomocou ktorej stahujem obrazky tymto kodom:
If Not String.IsNullOrEmpty(Me.Request.QueryString("Tool")) Then
Dim Subor As String = HttpContext.Current.Server.HtmlDecode(Me.Request.QueryString("Tool"))
Dim SuborCesta As String = Server.MapPath("~/App_Data/Downloads/Images/" & Subor & ".png")
If IO.File.Exists(SuborCesta) Then
Response.ClearHeaders()
Response.ClearContent()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment; filename=ToolImage.png")
Response.WriteFile(SuborCesta)
Response.End()
End If
End If
a v desktopovej aplikacii mam na stiahnutie obrazku tento kod:
Try
Dim fileReader As New WebClient()
imageAddress = ToolList(i).ToolImage
filename = ToolList(i).ToolFullName & ".png"
If Not (System.IO.File.Exists(My.Application.Info.DirectoryPath & "\Images\" + filename)) Then
fileReader.DownloadFile(New Uri(imageAddress), My.Application.Info.DirectoryPath & "\Images\" + filename)
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
ak zadam tu adresu do prehliadaca, obrazok sa stiahne bez problemov ale ak to urobim cez opisany kod, tak ako obsah obrazku sa stiahne html kod stranky a nie obrazok. neviete ako sa dostanem k tomu obrazku? hladal som riesenie nenasiel som ho.
|