Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Kelley Lawson   on Jun 17 In Asp.net Category.

  
Question Answered By: Burk Martin   on Jun 17

Here is the code: the uri is an https  - no error - the server I am
posting to simply says that there are no parameters being passed and
that causes the program on their end to return  no data.

Function readHtmlPage(ByVal url As String, ByVal stufftopost As
String) As String
Dim proxyObject As WebProxy
proxyObject = New WebProxy("xxx.xxx.xxx.xxx", 8080)
proxyObject.BypassProxyOnLocal = True
GlobalProxySelection.Select = proxyObject

Dim cert As X509Certificate
cert = X509Certificate.CreateFromCertFile("c:\fdcert.cer")

Dim result As String = ""
Dim strPost As String = stufftopost
Dim myWriter As StreamWriter

Dim url2 As String
url2 = url & stufftopost
Dim objRequest As HttpWebRequest = WebRequest.Create(url)
objRequest.ClientCertificates.Add(cert)
objRequest.Method = "POST"
objRequest.ContentLength = strPost.Length
objRequest.ContentType = "application/x-www-form-urlencoded"

Try
myWriter = New StreamWriter(objRequest.GetRequestStream
())
myWriter.Write(strPost)
Catch e As Exception
Return e.Message
Finally
myWriter.Close()
End Try

Dim objResponse As HttpWebResponse = objRequest.GetResponse()
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
sr.Close()

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on screen scraping with https Or get search suggestion and latest updates.


Tagged: