War am Handy und konnte den Code da nicht schreiben
Code:
Imports System.Net
Imports System.Threading
Public Class frmMain
Public cookie As CookieContainer = New CookieContainer()
Public content As String
Private Sub lc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lc.Click
lc.Text = ""
End Sub
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
content = WebRPOST("http://de.board.bigpoint.com/darkorbit/login.php?do=login", "vb_login_username=" + username.Text + "&vb_login_password=" + pw.Text + "&s=&do=login&vb_login_md5password=&vb_login_md5password_utf=", cookie)
Thread.Sleep(3000)
content = WebRGET("http://de.board.bigpoint.com/darkorbit/index.php", cookie)
End Sub
End Class
HttpWebRequest Klasse:
Code:
Imports System.Net
Imports System.IO
Imports System.Text
Module HTTP
Public Function WebRPOST(ByVal sUrl As String, ByVal sPost As String, ByVal cookies As CookieContainer) As String
Try
Dim nRequest As HttpWebRequest = CType(WebRequest.Create(sUrl), HttpWebRequest)
nRequest.Method = "POST"
nRequest.CookieContainer = cookies
nRequest.ContentType = "application/x-www-form-urlencoded"
nRequest.Proxy = New WebProxy()
Dim nbyteArray() As Byte = Encoding.UTF8.GetBytes(sPost)
nRequest.ContentLength = nbyteArray.Length
Dim nDataStream As Stream = nRequest.GetRequestStream()
nDataStream.Write(nbyteArray, 0, nbyteArray.Length)
nDataStream.Close()
nRequest.KeepAlive = True
nRequest.AllowAutoRedirect = True
nRequest.PreAuthenticate = True
Dim nResponse As HttpWebResponse = nRequest.GetResponse()
nDataStream = nResponse.GetResponseStream()
Dim nreader As New StreamReader(nDataStream)
Dim nServerResponse As String = nreader.ReadToEnd()
nreader.Close()
nDataStream.Close()
nResponse.Close()
Return nServerResponse
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try
End Function
Public Function WebRGET(ByVal sUrl As String, Optional ByRef cookies As CookieContainer = Nothing) As String
Static cookiecontainer As CookieContainer
Static cookiecoll As CookieCollection
Try
If (cookiecoll Is Nothing) Then
cookiecoll = New CookieCollection
End If
If (cookiecontainer Is Nothing) Then
cookiecontainer = New CookieContainer
End If
Dim req As HttpWebRequest = DirectCast(HttpWebRequest.Create(sUrl), HttpWebRequest)
req.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)"
req.Method = "GET"
req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
req.Referer = "http://de.board.bigpoint.com/darkorbit/login.php?do=login"
req.KeepAlive = True
req.CookieContainer = New CookieContainer()
req.CookieContainer = cookiecontainer
req.CookieContainer.Add(cookiecoll)
req.Proxy = New WebProxy()
Dim response As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
Dim sr As StreamReader = New StreamReader(response.GetResponseStream())
Dim html As String = sr.ReadToEnd()
sr.Close()
response.Close()
Return html
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
End Try
End Function
Static cookiecontainer As CookieContainer
Static cookiecoll As CookieCollection
Try
If (cookiecoll Is Nothing) Then
cookiecoll = New CookieCollection
End If
If (cookiecontainer Is Nothing) Then
cookiecontainer = New CookieContainer
End If
dafuq ist this, wie wärs mit genau so machen wie im post, nämlich einfach den übergebenen cookiecontainer in den request packen
ich gehe sehr stark davon aus das dort der fehler ist.
btw nen sleep bei der nutzung von webrequests ist absolut nicht notwendig
Ich wollte nurnoch eben anmerken, dass man vielleicht bei der Bindung der Variablen im String besser kein + nutzen sollte sondern ein &(jedenfalls bei VB.NET).
Das Sleep hab ich danach rein, als es nicht ging.
Die Klasse von nem Kumpel.
Ich binde Strings immer mit +, da ich demnächst auf C# umsteigen möchte. Daher gewöhne ich mit das + an.
Hab mir sagen lassen, dass & dort ganz böse ist
Naja und VB wird dir irgendwann dein + um die Ohren hauen. Ich kenne keinen VB-Code im Netz der ein + als Bindung verwendet. In dem jetzigen Beispiel mag es für dich OK sein. Aber ich kriege Bauchschmerzen wenn ich das sehe.
Edit. Ich denke nicht nur ich kriege Bauschmerzen ^^.
Metin2 Login problem HARD PROBLEM! 04/04/2013 - Metin2 Private Server - 0 Replies Hi im Immortal93 from romania i do not speak deutch , i speak a little english i hope you understand what i will say
I downoaded lauling serverfilles from elitepvpers.com and i have a problem with the char... i create a account , i log in , i am making the character and when i log in to the "world" it will not work if the selected region is blue "jinno" if i create jinno account dont works but if i create red or yellow it will work... please help me sorry for my bad english
ived changed...
WRPSP Forum Login Problem & Kick/Ban? 08/16/2012 - WarRock - 2 Replies Hey, ahm ich hab mir vor einigen Wochen den Account erstellt und gestern mal wieder reingeschaut und anscheinend sind die Server jetzt online. ^^ Ich kann auch spielen und so, aber auf der Homepage kann ich mich nicht einloggen. Wenn ich da meine Infos eingebe komme ich nur zur Startseite, aber bin nicht eingeloggt.
Außerdem als ich gestern ein bisschen gezockt habe ist mir was sehr seltsames passiert, und zwar war ich in einem Khali 4vs4 Raum und hab 1-2 Runden "normal" gespielt und in...
[M2.SG] Forum Login? 02/02/2011 - Metin2 - 3 Replies Es kommt andauernd die Meldung, obwohl ich 1000%ig mein Forumnamen und PW RICHTIG eingegeben habe, habe jetzt schon 15Min. Sperre weil ich es zu oft versucht habe :D
könnt ihr euch einloggen?