在调用GetResponse方法之前,我该如何将HttpWebRequest对象以字符串形式查看? 我想要查看请求的原始格式,就像在Fiddler中一样:
我尝试了以下代码,但是无法工作,因为流不可读。
Content-Type: multipart/form-data; boundary=---------------------------2600251021003
Content-Length: 338
-----------------------------2600251021003 Content-Disposition: form-data; name="UPLOAD_FILEName"; filename="Searchlight062210 w price.csv" Content-Type: application/vnd.ms-excel
,,,,,
-----------------------------2600251021003
Content-Disposition: form-data; name="submit"
submit
-----------------------------2600251021003--
我尝试了以下代码,但是无法工作,因为流不可读。
string GetRequestString(HttpWebRequest req)
{
Stream stream2 = req.GetRequestStream();
StreamReader reader2 = new StreamReader(stream2);
return reader2.ReadToEnd();
}