[help]

01/28/2012 13:45 Bierkiste#1
Code:
Option Strict On
Option Explicit On

Imports System.IO
Imports System.Net
Imports System.Text

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cookieCon As New CookieContainer
        Dim request As HttpWebRequest = DirectCast(HttpWebRequest.Create("http://www.metin2.de/user/login"), HttpWebRequest)
        request.Method = "POST"
        request.UserAgent = "Mozilla/5.0 (Windows NT 6.0; rv:9.0.1) Gecko/20100101 Firefox/9.0.1"
        request.ContentType = "application/x-www-form-urlencoded"
        Dim post As String = "username=" & TextBox1.Text & "&password=" & TextBox2.Text

        Dim byteArr() As Byte = Encoding.UTF8.GetBytes(post)
        request.ContentLength = byteArr.Length

        Dim dataStream As Stream = request.GetRequestStream()
        dataStream.Write(byteArr, 0, byteArr.Length)

        Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
        Dim reader As New StreamReader(response.GetResponseStream())
        Dim seitenQuelltext As String = reader.ReadToEnd()

        If seitenQuelltext.Contains("Sicher") Then
            MsgBox("Account funktioniert!", MsgBoxStyle.Information)
        Else
            MsgBox("Account funktioniert nicht!", MsgBoxStyle.Critical)
        End If


    End Sub
End Class

Was ist Falsch?
01/28/2012 14:00 Diablo_#2
Was kommt denn für eine (Fehler)Meldung? Garkeine?
01/28/2012 14:28 Kraizy​#3
Schau im Quelltext selbst nach, ob es eine Fehlermeldung gab.
01/28/2012 14:42 Bierkiste#4
Code:
        If seitenQuelltext.Contains("Login nicht erfolgreich. Benutzername oder Passwort falsch.") Then
            MsgBox("Login nicht erfolgreich!", MsgBoxStyle.Critical)
        Else
            MsgBox("Login erfolgreich!", MsgBoxStyle.Information)
        End If

Und die Fehlermeldung lautet:
Quote:
Login nicht erfolgreich. Benutzername oder Passwort falsch.

Jedoch wenn ich das so mache wie oben, dann Login Erfolgreich obwohl es Sinnfreie-Daten sind wie z.B

ID: Sex
PW: Sex
01/28/2012 23:32 Reextion#5
Probiers mal andersrum.

If seitenQuelltext.Contains("Benutzerdaten") Then MsgBox("Login erfolgreich!")
Else
MsgBox("Login nicht erfolgreich!")
End If