The remote server returned an error: (422)

Ramesh Soni picture Ramesh Soni · May 8, 2009 · Viewed 22.5k times · Source

I am getting following error when I am trying to get WebResponse using

WebResponse response = request.GetResponse()

The remote server returned an error: (422).

at System.Net.HttpWebRequest.GetResponse()
   at HopSharp.HoptoadClient.Send(HoptoadNotice notice) in D:\Projects\...dClient.cs:line 65

Does anyone have idea about this exception?

Answer

driis picture driis · May 8, 2009

That exception means that the web server responded with an error code, namely 422. You will need to check with the administrator of the remote site, why that might be. (Or look at the body of the response if any was returned, it might include some hints).

Here is the explanation of error code 422: http://tools.ietf.org/html/rfc4918#section-11.2

The request you are sending to the server is most likely invalid in some way or another. What the exact error might be, is impossible to tell without knowing which request you are sending against which system.