Question

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.

Was it helpful?

Solution

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";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top