Beispiel #1
0
        /// <summary>
        /// Encode url address to make it unknown
        /// </summary>
        /// <param name="url">A url address</param>
        public static string EncodeUrl(string url)
        {
            string result = UrlEncoders.EncodeToASProxyBase64(url);

            result += Consts.Query.Base64Unknowner;
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Decode url address from unknown to know mode
        /// </summary>
        /// <param name="url">An encoded url address</param>
        public static string DecodeUrl(string url)
        {
            string result = url;
            int    pos    = url.LastIndexOf(Consts.Query.Base64Unknowner);

            if (pos != -1)
            {
                // After Base64Unknowner nothing is needed, so we can remove them
                // This can fix lots of javascript generated URLs bad behaviour
                // Since v5.0
                result = result.Substring(0, pos);
            }

            // BUGFIX: Base64 hash algorithm encodes (~) chracter to (+) and browsers indicates that this is a space!!
            // So, I have to replace spaces with (+) character
            // Since v5.0
            result = result.Replace(' ', '+');

            result = UrlEncoders.DecodeFromASProxyBase64(result);
            return(result);
        }