title: decode base64 in c# when encoding in python
body: <p>I encode data of images in base64 using python before sending it to the server which is written in C#. The data that is received is identical to the data that is being sent. However, when I decode the encoded string I get a different result. 
  Here is the code that takes a screenshot and encodes it in base64:</p>
  
  <pre><code>screen_shot_string_io = StringIO.StringIO()
  ImageGrab.grab().save(screen_shot_string_io, "PNG")
  screen_shot_string_io.seek(0)
  return base64.b64encode(screen_shot_string_io.getvalue())
  </code></pre>
  
  <p>it is sent as is to the server and the server receives the encoded string correcetly with no data corruption.</p>
  
  <p>Here is the c# code that decodes the string:</p>
  
  <pre><code>byte[] decodedImg = new byte[bytesReceived];
  FromBase64Transform transfer = new FromBase64Transform();
  transfer.TransformBlock(encodedImg, 0, bytesReceived, decodedImg, 0);
  </code></pre>
  
  <p>So does anyone know why when the data is decoded the result is incorrect?</p>