Problem mit HttpWebrequest

10/13/2015 01:34 Baaaawz ヅ#1
Ich habe ein Problem mit HttpWebrequest. Ich würde mich gerne auf Xing.com einloggen, klappt aber einfach nicht. Habe schon alles probiert, es geht nicht -.-

Wenn ich mit dem Code eine andere Seite nehme, klappt es wunderbar!

mein Code:

PHP Code:
  With New Http
            Dim html 
As String String.Empty

            
Dim username As String "XXX"
            
Dim password As String "XXX"

            
html = .GetResponse("https://login.xing.com/login")
            
Dim auth GetBetween(html"name=""authenticity_token"" value=""""""")


            
Dim Post =  "authenticity_token=" auth "utf8=%E2%9C%93&locale=en&login_form%5Bdest_url%5D=https%3A%2F%2Fwww.xing.com%2Flogin%2Fpong%3Fdest%3D%252F&login_form%5Bsection%5D=core&login_form%5Btoken_param%5D=auth_token&login_form%5Busername%5D=" username.Replace("@""%40") + "&login_form%5Bpassword%5D=" password "&login_form%5Bperm%5D=0"


            
html = .GetResponse("https://login.xing.com/login"Post)

 
Console.Write(html)
 
End With 
Ich nutze folgende klasse:
PHP Code:
Option Strict On
Option Explicit On

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

Public Class Http
    Dim cookieCon 
As New CookieContainer
    Dim request 
As HttpWebRequest
    Dim response 
As HttpWebResponse

    
Public Function GetResponse(ByVal url As String) As String
        request 
CType(HttpWebRequest.Create(url), HttpWebRequest)
        
request.CookieContainer cookieCon
        response 
CType(request.GetResponse(), HttpWebResponse)

        Return New 
StreamReader(response.GetResponseStream()).ReadToEnd()
    
End Function

    Public Function 
GetResponse(ByVal url As StringByVal post As String) As String
        request 
CType(HttpWebRequest.Create(url), HttpWebRequest)
        
request.Method "POST"
        
request.CookieContainer cookieCon
        request
.UserAgent "Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0"
        
request.ContentType "application/x-www-form-urlencoded"

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

        Dim dataStream 
As Stream request.GetRequestStream()
        
dataStream.Write(byteArr0byteArr.Length)

        
response CType(request.GetResponse(), HttpWebResponse)

        Return New 
StreamReader(response.GetResponseStream()).ReadToEnd()
    
End Function
End Class 
Kann mir jemand helfen?

Es kommt auch keine Fehlermeldung das falsche Daten kommen, er schickt einfach immer nur die Loginseite zurück als ob nichts wäre -.-