I am trying to download an xml file from a website with c#, but I get an 404 on some urls. this is wired because they still work in the browser. Other urls still work without a problem.
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(url);
request.Method = "GET";
request.Timeout = 3000;
request.UserAgent = "Test Client";
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)
request.GetResponse();
}
catch (WebException e)
{
response = (HttpWebResponse)e.Response;
}
Console.WriteLine("- "+response.StatusCode);
XmlTextReader reader = XmlTextReader(response.GetResponseStream());
This URL is one of the said problem URLs:
http://numerique.bibliotheque.toulouse.fr/cgi-bin/oaiserver?verb=ListMetadataFormats
SOLVED....forgot to trim the url ;)