asp.netamazon-web-serviceshttpwebrequestgetresponse

How to Request.GetResponse() Amazon-hosted websites


I'm trying to get a response (check if a URL exists) for a number of Amazon-hosted retail sites.

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

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


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";