Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27201

[VB 2010 Express] Webclient and https

$
0
0
I am having issues with the WebClient Class in vb.net. I have an application that is automating the download of files. I ran into an issue with sites that are https and require selecting a digital certificate. The direct URL link from the browser works fine and brings up the dialog box to select the correct certificate (CAC based authentication).

Using my application I receive http 403/ forbidden error. I used Fiddler to identify two issues.
1. When using the direct link from the browser to the site the header displays 443 http/1.0, but the same link from my application uses 443 http/1.1.
2. Discovered I have no header information being displayed when using my application, and I am not sure if this would create problems.



Here is the code.
Code:

        Try
            ' Make a WebClient.
            Dim web_client As WebClient = New WebClient

            ' Download the file.
            web_client.DownloadFile(source, destination)

        Catch err As Exception
            toolsets.ListView1.Items.Add(New ListViewItem({source, err.Message})).ForeColor = Color.Firebrick
        End Try
    End Sub


Any help would be appreciated.

Viewing all articles
Browse latest Browse all 27201

Trending Articles