title: Encoding strings to and from base-64
body: <p>I'm trying to encode some strings back and forth from base-64 string and I'm having truble to get the right result.</p>
  
  <pre><code>string text = base64string.... //Here I have a base-64 string.
  byte[] encodedByte = System.Text.ASCIIEncoding.ASCII.GetBytes(text);
  string base64Encoded = Convert.ToBase64String(encodedByte);
  
  if (text == base64Encoded) //If the new encoded string is equal to its original value
      return base64Encoded;
  </code></pre>
  
  <p>I have tried my ways to do this and I don't seem to get the right result. I have tried both with <code>System.Text.Encoding.Unicode</code> and <code>System.Text.Encoding.UTF8</code></p>
  
  <p>What could be the problem? Does anyone have a proper solution?</p>