示例#1
0
        /// <summary>
        /// 把指定的字符串加密为可以通过Url传递的字符串
        /// </summary>
        /// <param name="rawString"></param>
        /// <returns></returns>
        public static string EncryptUrlString(string rawString)
        {
            //追加时间戳,方便后续判断
            string nowTicks = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);

            string newParam = string.Format("{0}-{1}", nowTicks, rawString);

            string result = EncryptByTriple(newParam);

            result = EncodingUtility.ToBase64FromGb2312(result);
            result = HttpUtility.UrlEncode(result);
            return(result);
        }