HTTP发送请求在服务器上发送失败

时间:2012-08-13 14:21:22

标签: asp.net

我试图发布这些变量引发了一个引擎,它回复了一个响应,但在VStudio上进行测试时,一切正常。当我在服务器上传它时,不会停止发布请求。

Dim webStream As Stream
Dim s As HttpWebRequest`enter code here`
Dim res As HttpWebResponse
Dim webResponse = ""
Dim enc As UTF8Encoding
Dim postdata As String
Dim postdatabytes As Byte()

s = HttpWebRequest.Create("http://private.pin-pay.com:3902/")
enc = New System.Text.UTF8Encoding()
postdata = "PN=961" & ddlPhone.SelectedValue & txtMobilePhone.Text & "&TI=" & TransactionID.Text
postdatabytes = enc.GetBytes(postdata)
s.Method = "POST"
s.ContentType = "application/x-www-form-urlencoded"
s.ContentLength = postdatabytes.Length
Using stream = s.GetRequestStream()
    stream.Write(postdatabytes, 0, postdatabytes.Length)
End Using
res = s.GetResponse()

webStream = res.GetResponseStream()
Dim webStreamReader As New StreamReader(webStream)
While webStreamReader.Peek >= 0
    webResponse = webStreamReader.ReadToEnd()
End While

0 个答案:

没有答案