문제

I`m trying to download string from address "http://www.last.fm/music/Boney%20M./+images",but return null,

WebClient webClient = new WebClient();
string html = webClient.DownloadString(new Uri("http://www.last.fm/music/Boney%20M./+images"));
도움이 되었습니까?

해결책

Just tried it on a test application under VS2012 Express, and it's working as intended.

Some thoughts:

  • The problem may lie in the fact that you are behind a proxy, and you may need to create a WebProxy object and provide your credentials.
  • Sometimes (which is not the case, since it worked for me) sites expect some headers - for example HTTP_REFERER.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top