Question Error in retriving webpage

zhuanyi

New member
Joined
Mar 15, 2010
Messages
3
Programming Experience
1-3
Need to retrieve a webpage similar to this:
https://thereserve1.apx.com/mymodule/rpt/CertificateInfo.asp?ad=Prpt&RIID=218&ftType=PRO

And here is what I used:
VB.NET:
 myRequest = DirectCast(System.Net.WebRequest.Create(sURL), System.Net.HttpWebRequest)
 myResponse = DirectCast(myRequest.GetResponse(), System.Net.HttpWebResponse)

                If myResponse.StatusCode = "200" Then
                    sHTML = (New StreamReader(myResponse.GetResponseStream)).ReadToEnd
                Else
                    'problem with data
                    sHTML = ""
                End If

and when I ran the code, there is a 407 exception.

I tried to download the certificate from the website and add it to the program:
VB.NET:
 Dim myCert As X509Certificate = X509Certificate.CreateFromCertFile("LOCATION TO CERT FILE ON MY COMPUTER")
                ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf MyCertValidationCarbon)
                myRequest.ClientCertificates.Add(myCert)

and I ended up having the same 407 error returned to me.

I have verified the internet settings are all OK and I was able to pull the website from IE, as well as other secured pages from other websites using the same code.

Could you please help?

Thanks!
 
Back
Top