这是我写的代码。
NameValueCollection values = new NameValueCollection();
values.Add("ctl00$ContentPlaceHolder1$ctrl9$txtDate1", "01.01.2012");
values.Add("ctl00$ContentPlaceHolder1$ctrl9$txtDate2", "26.11.2012");
values.Add("ctl00$ContentPlaceHolder1$ctrl9$cmbSymbol", "DHP");
using (WebClient client = new WebClient())
{
client.Headers.Add("ContentType","application/x-www-form-urlencoded");
client.Headers.Add("Cookie","ASP.NET_SessionId");
client.Headers.Add("userAgent","Opera/9.80 (Windows NT 5.1) Presto/2.12.388 Version/12.16");
client.Headers.Add("Host","www.mse.mk");
client.Headers.Add("Accept","text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1");
client.Headers.Add("KeepAlive","true");
byte[] result = client.UploadValues("Some Url", "POST", values);
}
但是当我运行此代码时,我得到了异常“尝试了太多的自动重定向”。所以我的问题是错误在哪里以及如何解决它。
由于