Base64 加密解密


        /// 
        /// 编码  Base64
        /// 
        /// 
        /// 编码 
        /// 
        public static string EncodeBase64(string code, string code_type = "utf-8")
        {
            string encode = "";
            byte[] bytes = Encoding.GetEncoding(code_type).GetBytes(code);
            try
            {
                encode = Convert.ToBase64String(bytes);
            }
            catch
            {
                encode = code;
            }
            return encode;
        }
        /// 
        /// 解码  Base64
        /// 
        /// 
        /// 编码
        /// 
        public static string DecodeBase64(string code, string code_type = "utf-8" )
        {
            string decode = "";
            byte[] bytes = Convert.FromBase64String(code);
            try
            {
                decode = Encoding.GetEncoding(code_type).GetString(bytes);
            }
            catch
            {
                decode = code;
            }
            return decode;
        } 
C