Exemple #1
0
        public string ToString(bool unicode)
        {
            StringBuilder queryString = new StringBuilder(QueryStrings.Count * 12);

            IDictionaryEnumerator e = QueryStrings.GetEnumerator();

            while (e.MoveNext())
            {
                queryString.Append(StringHelper.Convert(e.Key));
                queryString.Append('=');
                queryString.Append(HttpUtility.UrlEncode(StringHelper.Convert(e.Value)));
                queryString.Append('&');
            }

            if (queryString.Length > 0)
            {
                queryString.Remove(queryString.Length - 1, 1);
            }

            string encryptedQuery = StringHelper.Encrypt(queryString.ToString());

            string encodedQuery = HttpUtility.UrlEncode(encryptedQuery);

            if (unicode)
            {
                //Required if we are passing it to JavaScript
                encodedQuery = HttpUtility.UrlEncodeUnicode(encodedQuery);
            }

            if (encodedQuery.Length > 0)
            {
                return(_pageUrl + "?" + ENCRYPTED_KEY + "=" + encodedQuery);
            }
            else
            {
                return(_pageUrl);
            }
        }