HttpWebRequest身份验证

时间:2015-04-21 11:17:42

标签: c# webclient

我们在下面的课程中提到了http post方法

public static class Http
    {
        public static byte[] Post(string uri, NameValueCollection pairs)
        {
            byte[] response = null;
            using (WebClient client = new WebClient())
            {
                response = client.UploadValues(uri, pairs);
            }
        return response;
        }
    }   

我们正在尝试登录但无法登录, 请参阅下面提到的post方法及其参数。

var response = Http.Post("https://test.com/login.shtml", new     NameValueCollection() {
    { "accountname", "XXXX" },
    { "username", "XXXX" },
    { "password", "XXXX" },
});

0 个答案:

没有答案