Hi all!
I'm trying to download an xml file from a location using the WebClient class.
When I try a normal web address like "http://www.bbc.co.uk" there is no problem. However, when i try this kind of address "http://snooker/somedomain.com/"
I get the error The remote name could not be resolved: 'snooker'.
Here is my code:
WebClient wcWebClient = new WebClient();
wcWebClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1;en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4");
wcWebClient.Headers.Add("Accept-Language", "en-us,en;q=0.5");
byte[] reqHTML = null;
//next line is where i get the error
reqHTML = wcWebClient.DownloadData("http://snooker/somedomain.com/");
Any help and/or advice to resolve this will be gratefully received.
Many thanks in advance.
Tony
Loading
Kirtan PatelPosted Nov 5, 2009, 6:11 AM
Error is because of
http://snooker/somedomain.com/
is wrong URL of Domain because first application try to find a website with http://snooker then the subpath after /
but http://snooker its is not valid http path ,how can be a domain name without .com .in etc...
it should be like http://snooker.somedomain.com/ or http://snooker-somedomain.com/
if my answer helps you please check "Do you like the Answer" :)