title: client to server, server returns error but client thinks success
body: <p>MVC Application - uploading file from client to server through a stream:</p>
  
  <pre><code>string responseContents = string.Empty;
  
              HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  
              byte[] requestBytes = System.Text.Encoding.ASCII.GetBytes(message);
              request.Method = "POST";
              request.ContentType = "text/xml;charset=utf-8";
              request.ContentLength = requestBytes.Length;
  
              using (Stream requestStream = request.GetRequestStream())
              {
                  requestStream.Write(requestBytes, 0, requestBytes.Length);
                  requestStream.Close();
              }
  
              using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
              {
                  using (StreamReader sr = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default))
                  {
                      responseContents = sr.ReadToEnd();
                  }
              }
  </code></pre>
  
  <p>the problem is if there is an error on the server side, client account cant be found for example (the client account to save the upload to.) the responseContents returns an error:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;Result&gt;&lt;Value&gt;FAIL&lt;/Value&gt;&lt;Message&gt;Client Account can't be NULL&lt;/Message&gt;&lt;/Result&gt;
  </code></pre>
  
  <p>then continues on with the code </p>
  
  <pre><code>    Console.WriteLine("Server returns:");
              Console.WriteLine(responseContents);
  </code></pre>
  
  <p>and the client thinks this is a success.
  Is there any sort of way to check the responseContents returned xml for the word 'FAIL' so I can throw an error on the client side?</p>
  
  <p>Regards
  J</p>