c# - 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 call server, , getting following:

 |fatal|the remote server returned error: (406) not acceptable. (ref #1) system.net.webexception: remote server returned error: (406) not acceptable. 

why getting error? , how fix this?

according rfc

10.4.7 406 not acceptable

the resource identified request capable of generating response entities have content characteristics not acceptable according accept headers sent in request.

review accept headers request sending , , content server in url ; )


bonus

  • to see accept headers: browse url , use firebug (html tab).

  • to set accept headers request use httpwebrequest members.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -