Email Login Webrequest

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von petaod.

    Email Login Webrequest

    Hi liebe Gemeinde,

    ich verzweifel solange . Ich habe eine ein LOGIN für mein EMAIL ACCOUNT erstellt. Leider komme ich jedoch nicht rein . !!!

    könnt ihr vielleicht mal darübergucken.

    DES WEITEREN weiß ich nicht was ich bei der Überprüfung des LOGIN eingeben soll

    :cursing:



    hier der CODE:


    Visual Basic-Quellcode

    1. Imports System.IO, System.Net, System.Text
    2. Public Class Form1
    3. 'holds the cookies to keep you logged in
    4. Dim mainCookie As New CookieContainer
    5. Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
    6. 'taken from Live HTTP headers. This is the data
    7. 'that gets sent when logging in.
    8. Dim postData As String = "&kerio_username=" & txtUser.Text & "&kerio_password=" & txtPass.Text & "&submit=Login-button"
    9. 'when POSTing data, it needs to be in byte format.
    10. Dim bytes() As Byte = ASCIIEncoding.UTF8.GetBytes(postData)
    11. 'this is the page we are loggin into
    12. Dim postReq As HttpWebRequest = WebRequest.Create("http://mail.domainwtf.com/webmail/login/dologin")
    13. 'it's a POST request, not GET
    14. postReq.Method = "POST"
    15. postReq.KeepAlive = True
    16. 'holds our cookies
    17. postReq.CookieContainer = mainCookie
    18. 'comes from Live HTTP Headers, most likely the same for any request
    19. postReq.ContentType = "application/x-www-form-urlencoded"
    20. 'from Live HTTP Heasers, some sites require the correct referer
    21. postReq.Referer = "http://mail.domainwtf.com/webmail/login/"
    22. 'standard
    23. postReq.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 ( .NET CLR 3.5.30729; .NET4.0E)"
    24. 'length of our post data
    25. postReq.ContentLength = bytes.Length
    26. 'gets the stream to send data on
    27. Dim postStream As Stream = postReq.GetRequestStream()
    28. 'send the data
    29. postStream.Write(bytes, 0, bytes.Length)
    30. 'close the stream
    31. postStream.Close()
    32. 'get the response from the website
    33. Dim postResponse As HttpWebResponse
    34. postResponse = postReq.GetResponse()
    35. 'add the login cookies
    36. mainCookie.Add(postResponse.Cookies)
    37. 'reads the response
    38. Dim reader As New StreamReader(postResponse.GetResponseStream())
    39. 'puts the response into a string
    40. Dim strSource As String = reader.ReadToEnd
    41. 'if it says Welcome back then it worked
    42. If strSource.Contains("<title>webmail") Then
    43. MessageBox.Show("Login Successful")
    44. Else
    45. MessageBox.Show("Login Failed")
    46. End If
    47. End Sub
    48. End Class


    Visual Basic-Quellcode

    1. If strSource.Contains("<title>webmail") Then <---------------------
    2. MessageBox.Show("Login Successful")
    3. Else
    4. MessageBox.Show("Login Failed")


    Hier die ausgelesenen DATEN aus der EMAIL SEITE:


    mail.domainwtf.com/webmail/login/dologin

    POST /webmail/login/dologin HTTP/1.1
    Host: mail.domainwtf.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: de,en-US;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 67
    Referer: mail.domainwtf.com/webmail/login/
    Connection: keep-alive
    Upgrade-Insecure-Requests: 1
    kerio_username=xxxx@xxx.de&kerio_password=XXXXXX: undefined

    HTTP/1.1 302 Found
    Connection: Keep-Alive
    Content-Type: application/octet-stream
    Date: Fri, 5 May 2017 09:26:01 GMT
    Keep-Alive: timeout=15, max=99
    Location: mail.domainwtf.com/webmail/
    Server: WebServer
    Transfer-Encoding: chunked
    x-frame-options: SAMEORIGIN
    x-ua-compatible: IE=edge
    Set-Cookie: SESSION_CONNECT_WEBMAIL=1ac536e597c94bfec0b8af4dd7d98ae9683de639b38b1e24a339f37aa68ab69e; path=/; HttpOnly
    Set-Cookie: TOKEN_CONNECT_WEBMAIL=123f28a72a5e4067b921412a7eae61b7fe103d7a200f62ace97954c91622da2d; path=/

    Tausend Ausrufezeichen aus dem Titel entfernt. ~Trade

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Trade“ ()