Frage

I'm trying to get a response (check if a url exists) for a number of retail sites.

using HttpWebRequest.GetResponse(), I can get a response from Amazon's own site, however, I can't for its hosted sites - sepcifically MarksAndSpencer.com. The response is always 503.

I've used an http sniffer that always returns an answer so it does seem possible.

Has anyone got any solution to this as I'm finding it very difficult to come up with an answer or find one on Google.

War es hilfreich?

Lösung

I evenetually figured out how to successfully make a request to Amazon and Amazon hosted sites.

Heres the snippet of code.

var request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = WebRequestMethods.GET;
request.UserAgent = HttpContextHelper.Current.Request.UserAgent;
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top