Example #1
0
        private string SendRequest(NameValueCollection args)
        {
            args.Set("out", Constants.DefaultReturnFormat);
            args.Set("version", Constants.DefaultVersion.ToString());
            args.Add(AuthenticationOptions);

            var query = UriUtils.BuildUriString(args);

            var uri = new UriBuilder(Constants.EntryPoint + ServiceName)
            {
                Query = query
            };

            using (var client = new WebClient())
            {
                client.Encoding = System.Text.Encoding.UTF8;
                client.Headers.Add(HttpRequestHeader.UserAgent, Constants.DefaultUserAgent);
                var result = client.DownloadString(uri.Uri);
                XmlUtils.CheckForErrors(result);

                return(result);
            }
        }