Html & VB net how to download an img with a link inside a Tag?

1

After using a WebBrowser to login to a site with vb, I want to access my site profile, and download the img from my profile

<a href="#" data-target="#profile-photo" data-toggle="modal" class="profile-photo" style="background-image: url("LINK_IMG"); display: block;"><i class="fa fa-camera"></i></a>

Get the link to this part background-image: url ("LINK_IMG");

and then download automatically. Is it Possible?

    
asked by anonymous 17.05.2018 / 00:37

1 answer

0

Good morning, here's an example of downloading files.

1st - Create a Button in FrontEnd

<asp:Button ID="btnBaixarArq" runat="server" Text="Baixar Arquivo" />

2º - Refer to the Namespace below. Place at the top of the page

 Imports System.Net

3rd - Create the button click event event

Protected Sub btnBaixarArq_Click(sender As Object, e As EventArgs) Handles btnBaixarArq.Click
    Dim client As WebClient = New WebClient

    Try

        Dim urlArquivo As String = "http://ExemploDeSite.com.br/Teste/black.gif"
        Dim caminhoArquivo As String = "D:\PastaTeste"

        client.DownloadFile(urlArquivo, caminhoArquivo)

    Catch ex As Exception
        MsgBox("Erro ao fazer Download!")
    End Try
End Sub
    
18.05.2018 / 15:28