在云那方

首页 新随笔 联系 订阅 管理
/// <summary>
        /// POST获取HTML
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        string Post(string url, string param)
        {
            byte[] byData = Encoding.Default.GetBytes(param);
            var client = new WebClient();
            var data = client.UploadData(url, "Post", byData);
            return Encoding.Default.GetString(data);
        }

        /// <summary>
        /// GET获取HTML
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        string Get(string url)
        {
            var client = new WebClient();
            var data = client.DownloadData(url);
            return Encoding.Default.GetString(data);
        }

 

posted on 2008-07-04 15:16  Rich.T  阅读(598)  评论(0编辑  收藏  举报