5
如何在調用GetResponse方法之前將HttpWebRequest對象視爲字符串?我希望看到的要求是這樣的raw格式作爲小提琴手:請參閱HttpWebRequest作爲GetResponse之前的字符串,而不使用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();
}
tracemode =「protocolonly」in app.config is not accepted – Brij 2010-08-28 12:29:58
@brz dot net,不要相信Visual Studio。只需運行你的代碼,它就可以工作。肯定有這樣的元素。它甚至在MSDN上聲明:http://msdn.microsoft.com/en-us/library/ty48b824.aspx – 2010-08-28 12:31:39
+1偉人!意味着不需要小提琴手。 – Brij 2010-08-28 12:45:26