【发布时间】:2011-10-11 14:15:49
【问题描述】:
我正在使用带有修改后的 CookieAwareWebClient 类的 WebClient。
我希望它如何工作:我使用帖子登录,然后转到我发布类别 ID 的搜索页面,作为回报,我希望它给我列出类别的网站来源。我已经设法在 Python 上做到了,并且运行良好,但在 C# 上,我认为我在这里做错了。
ServicePointManager.Expect100Continue = false;
var client = new CookieAwareWebClient();
client.BaseAddress = @"http://site/";
// Logging in...
// This part works fine
var loginData = new NameValueCollection();
loginData.Add("login", "user");
loginData.Add("pass", "pass");
client.UploadValues("http://site/authorize.html", "POST", loginData);
// Searching for items
// Not so sure about this part since cannot read what is given back
var searchData = new NameValueCollection();
searchData.Add("catName", "tables");
client.UploadValues("http://site/search.html", "POST", searchData);
【问题讨论】: