好的,所以我打算在我得到的最后 3 个错误上发布这个,但我修复了所有这些(谢天谢地)。我不再收到任何类型的 cookie 阻止消息,但是现在无论我输入的是正确密码还是无效密码,我都会收到登录错误。我认为它要么 A. cookie 存储错误。B. 或重定向问题。
Imports System.Text
Imports System.Net
Imports System.IO
Public Class Form1
Dim logincookie As CookieContainer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim postData As String = "log=" & TextBox1.Text & "&pwd=" & TextBox2.Text & "wp- submit=Log+In&redirect_to=""http://csvlife.com/wp-admin/" & "&wordpress_test_cookie=1"
Dim tempcookies As New CookieContainer()
Dim encoding As New UTF8Encoding
Dim byteData As Byte() = encoding.GetBytes(postData)
Dim postreq As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://csvlife.com/wp-login.php"), HttpWebRequest)
postreq.Method = "POST"
postreq.KeepAlive = True
postreq.AllowAutoRedirect = True
postreq.CookieContainer = tempcookies
postreq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b6pre) Gecko/20100903 Firefox/4.0b6pre"
postreq.ContentType = "application/x-www-form-urlencoded"
postreq.Referer = "http://csvlife.com/wp-login.php"
postreq.ContentLength = byteData.Length
Dim postreqstream As Stream = postreq.GetRequestStream()
postreqstream.Write(byteData, 0, byteData.Length)
postreqstream.Close()
Dim postresponse As HttpWebResponse
postresponse = DirectCast(postreq.GetResponse, HttpWebResponse)
tempcookies.Add(postresponse.Cookies)
logincookie = tempcookies
Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
Dim thepage As String = postreqreader.ReadToEnd
If thepage.Contains("ERROR") Then
MsgBox("Error logging in!")
Else
MsgBox("Lets Start Blogging!")
End If
End Sub
End Class
我打开了我的提琴手,我已经登录到页面,并注意到当我通过常规浏览器定期登录时,提琴手会显示:
然后结果进来,它看起来像这样:
澄清:上面的图片是网络流量当我从计算机上的任何基本浏览器登录时,信息看起来像
这是我从程序登录的样子:
总是错误。
并且请求编号只是 200 没有 302 之前或之后。
但是,当我尝试通过我的程序时,请求编号始终保持为 200,即已发布。它就像它永远不会重定向,我不知道为什么。注意:这是我的网站,不适用于任何类型的恶意软件或其他任何东西。它只是用于博客自动化。如果我能在这件事上找到其他任何东西,我会的。在这一点上,我别无选择。感谢您的帮助和考虑。