質問

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.

役に立ちましたか?

解決

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";
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top