开发者

Invoking another URL

开发者 https://www.devze.com 2022-12-28 07:26 出处:网络
string url = \"http://foo.com/bar?id=\" + id + \"&more=\" + more; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    string url = "http://foo.com/bar?id=" + id + "&more=" + more;
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

I m trying make a call to another server, and getting back the following:

 |FATAL|The remote server returned an e开发者_Python百科rror: (406) Not Acceptable. (REF #1)
System.Net.WebException: The remote server returned an error: (406) Not Acceptable.

Why am i getting this error? and how to fix this?


According to the RFC

10.4.7 406 Not Acceptable

The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.

Review the accept headers that your request is sending , and the content server in that URL ; )


BONUS

  • To see the accept headers: browse to the URL and use FireBug (HTML tab).

  • To set the accept headers into your request use the HttpWebRequest Members.

0

精彩评论

暂无评论...
验证码 换一张
取 消