Пример #1
0
        /// <summary>
        /// 向远程Url Post数据
        /// </summary>
        /// <param name="uri">请求URL地址</param>
        /// <param name="data">请求参数</param>
        /// <returns>响应字符串</returns>
        public static string HttpPost(string uri, NameValueCollection data)
        {
            CNNWebClient _webClient = new CNNWebClient();

            _webClient.Encoding = Encoding.UTF8;
            _webClient.Timeout  = 300;
            byte[] _responeBuffer = _webClient.UploadValues(uri, "POST", data);
            return(Encoding.UTF8.GetString(_responeBuffer));
        }
Пример #2
0
        public static string HttpPost(string uri, System.Collections.Specialized.NameValueCollection data)
        {
            CNNWebClient wc = new CNNWebClient();

            wc.Encoding = Encoding.UTF8;
            wc.Timeout  = 300;
            var    t     = wc.UploadValues(uri, "POST", data);
            string tText = Encoding.UTF8.GetString(t);

            return(tText);
        }