因此,我已经尝试了该网站和其他网站(例如将近10个网站)上的许多代码,但它们均无法正常工作,我正在尝试登录此网站https://www.stressthem.to/login,并且如果登录正确无误,很好,它只是说loggin成功,只需使用c#控制台应用即可使用用户名和密码登录!这是我尝试过但没有起作用的一些代码.... 如果有人知道如何用$支付,您可以给我发instagram @vccm
static void Main(string[] args)
{
Console.WriteLine("f");``
Console.ReadLine();
string LoginSite(string url, string username, string password)
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
string cookie = "";
//this values will change depending on the website
string values = "vb_login_username=" + username + "&vb_login_password="
+ password
+ "&securitytoken=guest&"
+ "cookieuser=checked&"
+ "do=login";
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = values.Length;
CookieContainer a = new CookieContainer();
req.CookieContainer = a;
System.Net.ServicePointManager.Expect100Continue = false; // prevents 417 error
using (StreamWriter writer = new StreamWriter(req.GetRequestStream(),
System.Text.Encoding.ASCII)) { writer.Write(values); }
HttpWebResponse c = (HttpWebResponse)req.GetResponse();
Stream ResponseStream = c.GetResponseStream();
StreamReader LeerResult = new StreamReader(ResponseStream);
string Source = LeerResult.ReadToEnd();
foreach (Cookie cook in c.Cookies) { cookie = cookie + cook.ToString() + ";"; }
return cookie
我并没有真正记错任何错误,有些错误没有错误,但是工作量很大。