Thursday, April 26, 2012

C# - Encoding Strings to Base64


static public string EncodeTo64(string toEncode)
{
      byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
      string returnValue = System.Convert.ToBase64String(toEncodeAsBytes);
      return returnValue;
}

No comments:

Post a Comment