简体   繁体   中英

VB.NET Log-in via website without database how

I am trying to program a log-in form. I bought a domain from Wix.com and would like to run the log-in system on it. I would like registered users to be able to log in in the form and where it might even be checked whether they have a premium status or not.

I don't have access to my own members database on their site. That's why I tried HttpWebRequest but this is also not working (Or I did something wrong). Code:on another website as an example (HttpRequestMethode).

Dim User = TextBox1.Text, Pwd = TextBox2.Text
        Dim Request As HttpWebRequest = CType(WebRequest.Create("https://www.vb-paradise.de/index.php/Login/"), HttpWebRequest)
        Request.Method = "POST"
        Request.ContentType = "application/x-www-form-urlencoded"
        Dim Post As String = "email" & User & "password" & Pwd & "&useCookies=1&url="
        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()



        If InStr(ServerResponse, keyWord) Then 
            MessageBox.Show("Login nicht OK")
        Else
            MessageBox.Show("Login OK")
        End If

Does anyone have an idea how I can do it?

maybe someone among you has a better idea and maybe even a simpler one.

Assuming that your Web Request method works, you can use the .contains method to determine your response contains keyWord .

If ServerResponse is set to POST: HTTP/2.0 200 OK on failed login and it will be set to POST: HTTP/2.0 200 FOUND on valid login, search for the keyword or "FOUND" itself.

 If ServerResponse.Contains("FOUND") Then 
      'The POST text contains FOUND keyword
      MessageBox.Show("Login OK")
 Else
      'The POST text does not contain FOUND keyword
      MessageBox.Show("Login not OK")
 End If

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM