Calling another url
string url = "http://foo.com/bar?id=" + id + "&more=" + more;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
I am trying to make a call to another server and get this:
|FATAL|The remote server returned an error: (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 it?
+2
a source to share
1 answer
According to RFC
10.4.7 406 Not Acceptable
The resource specified in the request is capable of generating response objects that have content characteristics unacceptable according to the headers sent in the request.
Look at the accept headers sent by your request and the content server in that url; )
BONUS
-
To see accept headers: go to url and use FireBug (HTML tab).
-
Please use HttpWebRequest Members to set the Accept headers .
+1
a source to share