WebClient を使用してログイン フォームのデータを投稿しようとしましたが、何をしても 417 Expect エラーが返されます。「ServicePointManager.Expect100Continue = false;」を試しました そしてそれは何もしていません。これは私のコードのエラーかもしれないと疑い始めていますが、それが何であるかはわかりません。
public void initiateCredits(string user, string pass)
{
System.Net.WebClient wc2 = new System.Net.WebClient();
string webData = wc2.DownloadString("http://localhost");
Regex check = new Regex("(?<=You have)(.*)(?=credits)", RegexOptions.Singleline);
bool checkmatch = check.IsMatch(webData);
if (checkmatch == true)
{
return;
}
else
{
ServicePointManager.Expect100Continue = false;
DisableClickSounds();
string url = "http://localhost";
string pass_d = Base64.decode(pass);
string postData = String.Format("username=" + user + "&password=" + pass_d);
byte[] Post = Encoding.UTF8.GetBytes(postData);
WebClient wc = new WebClient();
byte[] response = wc.UploadValues(url, new NameValueCollection()
{
{ "username", user },
{ "password", pass_d }
});
creditlogin = true;
//string AdditionalHeaders = "Content-Type: application/x-www-form-urlencoded";
//wb.Navigate(url, null, Post, AdditionalHeaders);
}
これらのヘッダーを削除できないように見える理由、またはこのエラーが発生する理由を知っている人はいますか? ありがとう!