title: ArgumentException when converting byte[] to Bitmap c#
body: <p>I'm trying to convert a byte array to a bitmap but it always shows me: </p>
  
  <blockquote>
    <p>System.ArgumentException: Parameter is not valid.</p>
  </blockquote>
  
  <p>My code is as follows:</p>
  
  <p>I'm passing the bytes through a webservice with:</p>
  
  <pre><code> string DecodedString = string.Empty;
   DecodedString = System.Text.Encoding.GetEncoding(1251).GetString(bytes);
   sResult = sResult + "&lt;Photo&gt;" +XmlConvert.EncodeName(DecodedString) + "&lt;/Photo&gt;";
  </code></pre>
  
  <p>and in my webPage: </p>
  
  <pre><code>byte[] bytes = (Byte[])System.Text.Encoding.GetEncoding(1251).GetBytes(XmlConvert.DecodeName(xDocument.SelectSingleNode("Response/Images/Photo").InnerText));
      System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);
  
      System.Drawing.Bitmap b = new System.Drawing.Bitmap(ms);//(System.Drawing.Image.FromStream(ms));
  </code></pre>