C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

 public string GetPost(string url, params string[] data)
        {
            string tempMessage = "";
            System.Net.WebClient WebClientObj = new System.Net.WebClient();
            System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection();
            if (data.Length % 2 == 0)
            {
                for (int i = 0; i < (data.Length / 2); i++)
                {
                    PostVars.Add(data[i * 2], data[i * 2 + 1]);
                }
            }

            try
            {
                byte[] byRemoteInfo = WebClientObj.UploadValues(url, "POST", PostVars);
                //下面都没用啦,就上面一句话就可以了
                tempMessage = System.Text.Encoding.Default.GetString(byRemoteInfo);
                //这是获取返回信息

            }
            catch
            {

            }
            return tempMessage;

 

        }

posted on 2010-10-18 11:41  王德田  阅读(348)  评论(0编辑  收藏  举报