I have a web app which talks to a custom back-end server over HTTP. The server provides its responses in XML and I use Linq-to-XML to parse the results. If the server cannot process a query it will send back a 400 bad request header which includes detailed information about the problem. i.e.
HTTP/1.1 400 Bad Request (invalid query)
On the client side I use XDocument.Load(uri) to retrieve and parse the response. When a bad request happens, it throws a WebException. The problem is the Message property is set to "Bad Request". I don't know if it truncated the response string or if it just parsed the 400 code and generated the message on its own. Is there a way to get the original response string?