我在C#httpwebrequest中得到不同的页面

时间:2016-05-21 05:47:39

标签: c# web-crawler httpwebrequest

我正在使用此代码从americalapperal.com接收httpwebrequest来接收网页数据

var request = (HttpWebRequest)WebRequest.Create("http://store.americanapparel.net/en/sports-bra_rsaak301?c=White");
        request.UserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/49.0.2623.108 Chrome/49.0.2623.108 Safari/537.36";
        var response = request.GetResponse();
        //cli.Headers.Add ("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
        using (var reader = new StreamReader(response.GetResponseStream()))
        {
            var data = reader.ReadToEnd();
            return data;
        }

我正在接收来自此网址的数据

http://store.americanapparel.net/en/sports-bra_rsaak301?c=White

但是这个实时数据不同,我收到的httpwebrequest数据不同

我怎样才能在c#中获得准确的页面数据?

0 个答案:

没有答案