WebClient问题

sunrise10 2005-10-09 03:49:02
Byte[] bytePageData;
WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultCredentials;

NameValueCollection na = new NameValueCollection();

bytePageData = wc.DownloadData("www.aaa.com/index.aspx?bb=bb");
如果www.aaa.com/index.aspx是接收一post方式接收bb的值,改怎么修改这段程序,完成相同的功能呢?
...全文
201 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ar7_top 2005-11-22
  • 打赏
  • 举报
回复
老孟,你那个url不能访问
liuyu1981831 2005-10-09
  • 打赏
  • 举报
回复
myNameValueCollection.Add("query",Value);

应改为
myNameValueCollection.Add("bb","bb的值");
liuyu1981831 2005-10-09
  • 打赏
  • 举报
回复
byte[] responseArray = myWebClient.UploadValues(URL,"POST",myNameValueCollection );
其中 URL = "www.aaa.com/index.aspx"
liuyu1981831 2005-10-09
  • 打赏
  • 举报
回复
WebClient myWebClient = new WebClient();
NameValueCollection myNameValueCollection = new NameValueCollection();
myNameValueCollection.Add("query",Value);
byte[] responseArray = myWebClient.UploadValues(URL,"POST",myNameValueCollection );
conan19771130 2005-10-09
  • 打赏
  • 举报
回复
webclient有个方法就是下载文件的啊
孟子E章 2005-10-09
  • 打赏
  • 举报
回复
http://sz.luohuedu.net/xml/ShowDetail.asp?id=ATV1GLXT-65FF-4M82-CT5U-B1J65D3ZN2OK
time_is_life 2005-10-09
  • 打赏
  • 举报
回复
string uriString = "http://www.contoso.com/search";
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Create a new NameValueCollection instance to hold the QueryString parameters and values.
NameValueCollection myQueryStringCollection = new NameValueCollection();
Console.Write("Enter the word(s), separated by space character to search for in " + uriString + ": ");
// Read user input phrase to search for at uriString.
string searchPhrase = Console.ReadLine();
if (searchPhrase.Length > 1)
// Assign the user-defined search phrase.
myQueryStringCollection.Add("q",searchPhrase);
else
// If error, default to search for 'Microsoft'.
myQueryStringCollection.Add("q","Microsoft");
// Assign auxilliary parameters required for the search.
Console.WriteLine("Searching " + uriString + " .......");
// Attach QueryString to the WebClient.
myWebClient.QueryString = myQueryStringCollection;
// Download the search results Web page into 'searchresult.htm' for inspection.
myWebClient.DownloadFile (uriString, "searchresult.htm");
Console.WriteLine("\nDownload of " + uriString + " was successful. Please see 'searchresult.htm' for results.");

110,571

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧