通过HttpWebRequest的发布数据 [英] post data through httpWebRequest
问题描述
我需要邮报的一些数据到外部网站使用的HttpWebRequest
从我的应用程序(桌面)对象,并得到回应
回到我的应用程序通过 HttpWebResponse
对象。
但在其读音字发布数据的网页都具有动态名称文本框。
我怎么能在 HttpWebResquest
?
例如,当我加载页面的文本框的名字是这样的 U2FsdGVkX183MTQyNzE0MrhLOmUpqd3eL60xF19RmCwLlSiG5nC1H6wvtBDhjI3uM1krX_B8Fwc
但是当我刷新页面更名为这个 U2FsdGVkX182MjMwNjIzMPAtotst_q9PP9TETomXB453Mq3M3ZY5HQt70ZeyxbRb118Y8GQbgP8
。
感谢您的任何建议。
VAR请求= WebRequest.Create(HTTP://富);
request.Method =POST;
request.ContentType =应用/的X WWW的形式urlen codeD;
使用(VAR作家=新的StreamWriter(request.GetRequestStream()))
{
writer.Write(字段值=);
}
I need to "Post" some data to an external website using
HttpWebRequest
object from my application(desktop) and get a response
back into my application through HttpWebResponse
object.
But the webpage on which i m posting data have textboxes which have dynamic names.
How can I get the name of those textboxes and post data in HttpWebResquest
?
For example when I load the page the textbox name is like this U2FsdGVkX183MTQyNzE0MrhLOmUpqd3eL60xF19RmCwLlSiG5nC1H6wvtBDhjI3uM1krX_B8Fwc
but when I refresh the page name change to this U2FsdGVkX182MjMwNjIzMPAtotst_q9PP9TETomXB453Mq3M3ZY5HQt70ZeyxbRb118Y8GQbgP8
.
Thanks for any suggestions.
var request = WebRequest.Create("http://foo");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
using (var writer = new StreamWriter(request.GetRequestStream()))
{
writer.Write("field=value");
}
这篇关于通过HttpWebRequest的发布数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!