I'm at a loss here. I have created an API for a website of mine (If it's of any value, this is being locally hosted for easier development). I am trying to pass it some info via a simple GET request, but I'm running into a big problem.
Dim wc As WebClient = New WebClient()
Dim ServerResponse As String = wc.DownloadString(New Uri(entireRequest))
MsgBox("This will NEVER be run")
The above code is being run in a separate thread. The problem is that when the DownloadString
line is called, no other code afterwards is ever run. I have tried setting breakpoints after that line and none are hit.
A Try...Catch
block does nothing. I have tried catching Net.WebExceptions
and System.Exceptions. Nothing's ever caught. My breakpoint on End Try
is never hit..
I have noticed that this will only happen if entireRequest
is an https connection. This problem doesn't happen if it's not encrypted.
Adding the following in order to ignore the self-signed cert does nothing:
Public Class clsSSL
Public Shared Function AcceptAllCertifications(ByVal sender As Object, ByVal certification As System.Security.Cryptography.X509Certificates.X509Certificate, ByVal chain As System.Security.Cryptography.X509Certificates.X509Chain, ByVal sslPolicyErrors As System.Net.Security.SslPolicyErrors) As Boolean
Return True
End Function
End Class
Thanks in advance! I've done a lot of searching and you're my last hope!