Sub Login(Username As String, Password As String)
Username = SU.EncodeUrl(Username,"UTF8")
Password = SU.EncodeUrl(Password,"UTF8")
Dim Post As String = $"username=${Username}&password=${Password}&Submit=Login"$
HR.InitializePost2("https://www.meinedomain.de/postseite1.asp",Post.GetBytes("UTF8"))
HC.Initialize("Login")
HC.Execute(HR,0)
End Sub
Sub Login_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
If Reason = "Object moved" Then
Dim Location As String = Response.GetHeaders.Get("Location")
If Location = "[scondlogin.asp]" Then
Cookie = Response.GetHeaders.Get("Set-Cookie")
'Mit SubString2 werden die eckigen Klammern am Anfang und Ende entfernt
Cookie = Cookie.SubString2(1,Cookie.Length -1)
Log("Erster Login erfolgreich")
SecondLogin("Passwort")
Else
Log("Erster Login fehlgeschlagen")
End If
End If
End Sub
Sub SecondLogin(Password As String)
Password = SU.EncodeUrl(Password,"UTF8")
Dim Post As String = $"password2=${Password}&Submit2=Login"$
HR.InitializePost2("https://www.meinedomain.de/postseite2.asp",Post.GetBytes("UTF8"))
HR.SetHeader("Cookie",Cookie)
HC.Initialize("SecondLogin")
HC.Execute(HR,0)
End Sub
Sub SecondLogin_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
If Reason = "Object moved" Then
Dim Location As String = Response.GetHeaders.Get("Location")
If Not(Location = "[dotmessage.asp?dotmessage=You+have+entered+the+wrong+second+password%2E+%3Ca+href%3DDot%5FSecondPassword%2Easp%3EClick+here%3C%2Fa%3E+to+try+again+or+retrieve+your+account+%3Ca+href%3DDot%5Fforgotpassword%2Easp%3Ehere%3C%2Fa%3E%2E]") Then
Log("Zweiter Login erfolgreich")
Cookie = Response.GetHeaders.Get("Set-Cookie")
'Mit SubString2 werden die eckigen Klammern am Anfang und Ende entfernt
Cookie = Cookie.SubString2(1,Cookie.Length -1)
'Hier kannst du jetzt einen GetRequest veranlassen, vergess nicht den Cookie zu setzten mit:
'HR.SetHeader("Cookie",Cookie)
Else
Log("Zweiter Login fehlgeschlagen")
End If
End If
End Sub