Register for your free account! | Forgot your password?

You last visited: Today at 05:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[help]

Discussion on [help] within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Sep 2011
Posts: 364
Received Thanks: 53
[help]

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?
Bierkiste is offline  
Old 01/28/2012, 14:00   #2
 
Diablo_'s Avatar
 
elite*gold: 5
Join Date: Sep 2010
Posts: 9,927
Received Thanks: 4,387
Was kommt denn für eine (Fehler)Meldung? Garkeine?
Diablo_ is offline  
Old 01/28/2012, 14:28   #3
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
Schau im Quelltext selbst nach, ob es eine Fehlermeldung gab.
Kraizy​ is offline  
Old 01/28/2012, 14:42   #4
 
elite*gold: 0
Join Date: Sep 2011
Posts: 364
Received Thanks: 53
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: ***
PW: ***
Bierkiste is offline  
Old 01/28/2012, 23:32   #5

 
Reextion's Avatar
 
elite*gold: 407
Join Date: May 2009
Posts: 1,573
Received Thanks: 728
Probiers mal andersrum.

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




All times are GMT +1. The time now is 05:46.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.