我尝试了一些方法来获得以下网站的页面源代码: http://www.pope-bedrijfswagens.nl
。这个网站有自动重定向设置。
我尝试过下列方法:
WebClient client = new WebClient();
string sourceCode = "";
sourceCode = client.DownloadString(address);
还有
HttpWebRequest myWebRequest = (HttpWebRequest)HttpWebRequest.Create(address);
myWebRequest.AllowAutoRedirect = true;
myWebRequest.Method = "GET";
// make request for web page
HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse();
StreamReader myWebSource = new StreamReader(myWebResponse.GetResponseStream());
string myPageSource = myWebSource.ReadToEnd();
myWebResponse.Close();
我总是得到第一页的源代码 但我需要得到 源代码 该页面的源代码 网页 重定向。
http://www.pope-bedrijfswagens.nl
的重定向如下:
Type of redirect: “meta refresh” redirect after 0 second
Redirected to: http://www.poppe-bedrijfswagens.nl/daf-html/dealer_homepage.html
提前感谢