CSharp examples for System:String Base64
Encrypt UTF8 String with base 64 encoding
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;//from w w w .j a v a2 s .c om public class Main{ public static string Encrypt(string value) { string base64string = String.Empty; byte[] bytes = Encoding.UTF8.GetBytes(value); try { base64string = Convert.ToBase64String(bytes); } catch { base64string = value; } return base64string; } }