标签:
/// <summary> /// Base64编码 /// </summary> /// <param name="str">字符串</param> /// <returns></returns> public string StringToBase64(string str) { var bytes = System.Text.Encoding.UTF8.GetBytes(str); return Convert.ToBase64String(bytes); } /// <summary> /// Base64解码 /// </summary> /// <param name="str">字符串</param> /// <returns></returns> public string Base64ToString(string str) { var outputb = Convert.FromBase64String(str); return System.Text.Encoding.UTF8.GetString(outputb); }
标签:
原文地址:http://www.cnblogs.com/xiaoxiaoyu0707/p/5799651.html