[VB.NET] Ogame login geht nicht

02/16/2010 16:10 sh00ky#1
Hab das mit Ogame versucht aber bei Textbox3.Text = ServerResponse kommt nur son javascript text
HTML Code:
<script>document.location.href='http://ogame.de'</script>

Check das mit den Cookies nicht

der http header von ogame ist

Code:
http://barym.ogame.de/game/reg/login2.php

POST /game/reg/login2.php HTTP/1.1
Host: barym.ogame.de
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://ogame.de/?error=2
Cookie: vc1=1266328286; vc2=1266414330; prsess_148280=a83a6e342d459634ef08391dd40e3ca5; login_148280=U_de102:XXXXX:6d28f3397dc75ec21d527ad4ceff2a33; mbox=check#true#1266164424|session#1266164363735-349641#1266166224|PC#1266164363735-349641.15#1267373964; __utma=264069843.154346389.1266164364.1266164364.1266164364.1; __utmz=264069843.1266164364.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=ff173b6361dcab0ac565d1ca8904072d
Content-Type: application/x-www-form-urlencoded
Content-Length: 92
uni_id=101&v=2&is_utf8=0&uni_url=barym.ogame.de&login=XXXXXX&pass=XXXXXX&submitInput=Login
HTTP/1.1 302 Found
Date: Tue, 16 Feb 2010 13:45:44 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: prsess_148280=18a1c9d25782b040152324820eb63d7c; expires=Wed, 17-Feb-2010 13:45:44 GMT; path=/
Set-Cookie: login_148280=U_de102:CannaP:6d28f3397dc75ec21d527ad4ceff2a33; expires=Wed, 17-Feb-2010 13:45:44 GMT; path=/
Location: /game/index.php?page=overview&session=29583a4851a3&lgn=1
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Connection: close
Content-Type: text/html; charset=utf-8
Code:
 Dim User = "xxx", Pwd = "xxx"
        Dim cookies As CookieContainer

   Dim Request As HttpWebRequest = CType(WebRequest.Create("http://barym.ogame.de/game/reg/login2.php"), HttpWebRequest)
        Request.Method = "POST"
        Request.ContentType = "application/x-www-form-urlencoded"
        Request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7"

        Request.CookieContainer = cookies







        Dim Post As String = " uni_id=101&v=2&is_utf8=0&uni_url=barym.ogame.de&login=" & User & "&pass=" & Pwd & "&submitInput=Login"



        Dim byteArray() As Byte = Encoding.UTF8.GetBytes(Post)
        Request.ContentLength = byteArray.Length
        Dim DataStream As Stream = Request.GetRequestStream()
        DataStream.Write(byteArray, 0, byteArray.Length)
        DataStream.Close()

        Dim Response As HttpWebResponse = Request.GetResponse()
        DataStream = Response.GetResponseStream()
        Dim reader As New StreamReader(DataStream)
        Dim ServerResponse As String = reader.ReadToEnd()
        reader.Close()
        DataStream.Close()
        Response.Close()

        TextBox3.Text = ServerResponse
02/18/2010 22:21 schlurmann#2
Ich bin wirklich gegen solche Klassen und Wrapper. Du hast keinen Schimmer was im Hintergrund geschieht und hast im Grunde kaum eine Möglichkeit bei unerwarteten Fehlern einzuschreiten.

Ich habe zu wenig Ahnung von VB.NET und seinen Klassen. Aber mein Vorschlag:

Versuche es mit

Code:
Dim Request As HttpWebRequest = CType(WebRequest.Create("barym.ogame.de/game/reg/login2.php"), HttpWebRequest)
oder

Code:
Dim Request As HttpWebRequest = CType(WebRequest.Create("www.barym.ogame.de/game/reg/login2.php"), HttpWebRequest)
Ich weiß nicht wie VB intern den Namen auflöst. Könnte aber eine Fehlerquelle sein.

Auch die Content Length 'mal checken. Bin mir nicht sicher, dass die stimmt.

Code:
Request.ContentLength = byteArray.Length
02/19/2010 12:53 Cholik#3
Guck dir eventuell mal [Only registered and activated users can see links. Click Here To Register...] an...

Ist zwar C# aber sollte kein Problem sein das in VB.NET zu converten, falls du Probleme damit hast. Google.de "C# VB.NET Converter".