Invoking another 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.
精彩评论