如何检索发布的httpresponse数据

时间:2014-07-05 01:00:27

标签: asp.net vb.net post httpwebrequest httpwebresponse

我有一部分代码将httprequest发送到weburl然后响应再次使用post方法,如何从httpresponse获取发布的数据:

Dim request1 As HttpWebRequest = HttpWebRequest.Create("some url here"     & str)
    request1.Method = "POST"
    request1.CookieContainer = cookie
    enc = New System.Text.UTF8Encoding()
    postdatabytes = enc.GetBytes(postdt)

    request1.ContentType = "application/x-www-form-urlencoded"
    ' request1.ContentType = "application/json"
    request1.ContentLength = postdatabytes.Length
    'Dim strn As New StreamWriter(request1.GetRequestStream())
    'strn.Write(postdt)
    'strn.Close()

    Using stream = request1.GetRequestStream()
        stream.Write(postdatabytes, 0, postdatabytes.Length)


    End Using

    Dim r As String


    Dim response1 As HttpWebResponse = request1.GetResponse()
    If response1.Method = "POST" Then
        '' here I want to get response data
    End If

经过长时间的搜索,我没有找到任何答案......

0 个答案:

没有答案