【发布时间】:2010-12-20 20:58:07
【问题描述】:
我想制作一个桌面应用程序,在文本框中输入一个值并执行按钮操作,例如设计一个在 google.com 的谷歌搜索框中输入值并执行操作的应用程序,就像任何人按下搜索按钮时一样我写了一个代码但它抛出异常远程服务器返回错误:(405)方法不允许。
WebClient wc = new WebClient();
string uri = "http://google.com";
NameValueCollection nvc = new NameValueCollection();
nvc.Add("search", "afnan");
byte[] response = wc.UploadValues(uri, nvc);
textBox1.Text=Encoding.ASCII.GetString(response);
【问题讨论】:
标签: c# webclient web-crawler