/// <summary> /// DES加密方法加密链接参数 /// </summary> public static string DESEncryptEncode(string input, bool UrlEncode = true) { string encode = DES_Encrypt.EncodeToBase64(input.ToString()); encode = encode.Replace('/', '~'); encode = encode.Replace('+', '$'); encode = encode.Replace("%2b", "$"); if (UrlEncode) { encode = HttpUtility.UrlEncode(encode); } return(encode); }
/// <summary> /// DES加密方法解密链接参数 /// </summary> public static string DESEncryptDecode(string input, bool UrlDecode = true) { if (string.IsNullOrEmpty(input)) { return(string.Empty); } string decode = input; if (UrlDecode) { decode = HttpUtility.UrlDecode(input); } decode = decode.Replace('~', '/'); decode = decode.Replace("$", "+"); decode = DES_Encrypt.DecodeFromBase64(decode); return(decode); }