Use the 2 helpers methods below for encoding and decoding a base64 string.
public static string Base64Encode(string text)
{
var textBytes = System.Text.Encoding.UTF8.GetBytes(text);
return System.Convert.ToBase64String(textBytes);
}
public static string Base64Decode(string base64)
{
var base64Bytes = System.Convert.FromBase64String(base64);
return System.Text.Encoding.UTF8.GetString(base64Bytes);
}