예제 #1
0
        protected virtual Uri BuildUri()
        {
            RegisterDefaultUrlParams();

            var queryBuilder = new StringBuilder();

            for (var i = 0; i < UrlParams.Count; i++)
            {
                var item = UrlParams.ElementAt(i);

                queryBuilder.Append(i == 0 ? "?" : "&");

                var query = string.Format("{0}={1}", item.Key, item.Value);

                if (encryptUriQuery)
                {
                    query = query.Encrypt(cryptoKey);
                }

                var escapeStr = Uri.EscapeDataString(query);

                queryBuilder.Append(escapeStr);
            }

            var uriBuilder = new UriBuilder(HostUrl)
            {
                Query = queryBuilder.ToString(),
            };

            return(uriBuilder.Uri);
        }
예제 #2
0
        private Uri BuildUri()
        {
            RegisterDefaultUrlParams();

            var queryBuilder = new StringBuilder();

            for (var i = 0; i < UrlParams.Count; i++)
            {
                var item = UrlParams.ElementAt(i);

                queryBuilder.Append(i == 0 ? "?" : "&");

                var query = string.Format("{0}={1}", item.Key, item.Value);

                queryBuilder.Append(Uri.EscapeUriString(query));
            }

            var uriBuilder = new UriBuilder(HostUrl)
            {
                Query = queryBuilder.ToString(),
            };

            return(uriBuilder.Uri);
        }