Web服务HTTP PUT json请求正文vb

时间:2016-10-24 14:32:16

标签: json vb.net

PUT .../jobs/expenses/3434534534 HTTP/1.1 
Host: ....com
Connection: keep-alive
Content-Length: 251
Accept: application/json
Origin: .....com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,       like Gecko) Chrome/53.0.2785.143 Safari/537.36
Authorization: N/A
Content-Type: application/json
Referer: .....
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: .....

{"amount": 0, "timein": "11:11", "timeout": "12:11".....}

我一直在努力获取正在发送的json正文(用fiddler查看),但我总是得到一个空字符串。

在尝试读取信息之前,设置以下内容:HttpContext.Current.Request.InputStream.Position = 0仍会返回空字符串。

我试图提取此信息的各种方式

Dim myStream As Stream
myStream = HttpContext.Current.Request.InputStream
myStream.Position = 0
Dim myStreamReader As New StreamReader(myStream)
otherText = myStreamReader.ReadToEnd()


Dim bytes = New Byte(objRequest.InputStream.Length - 1) {}
objRequest.InputStream.Position = 0
objRequest.InputStream.Read(bytes, 0, bytes.Length)
otherText = System.Text.Encoding.Default.GetString(bytes)

如何提取我可以用小提琴手查看的这些信息,我探索过的所有途径都会产生相同的结果。空字符串。

0 个答案:

没有答案