Ciao a tutti,ho un problema nel effettuare il login sul mio sito,vi spiego qualcosa prima di postare il codice.
Ho realizzato 2 textbox e 1 bottone,dove nelle textbox ci sarà username e pass,il bottone dovrà mandare l'invio.
Il problema sta che non riesco a loggarmi,qualsiasi cosa poi scrivo,nell'username e pass mi da login effettuato
codice:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox5.Text = Nothing Then MessageBox.Show("Please enter your username") Button2.Enabled = True TextBox5.Select() ElseIf TextBox3.Text = Nothing Then MessageBox.Show("Please enter your password") TextBox3.Select() Else If Not TextBox5.Text Is Nothing And Not TextBox3.Text Is Nothing Then Me.Button2.Enabled = False MessageBox.Show("Ok, trying to LOG IN....") Try 'Address of URL Dim URL As String = "http://mysite.com/login.php?username=" & TextBox5.Text & "&password=" & TextBox3.Text Dim request As HttpWebRequest = CType(WebRequest.Create(URL), HttpWebRequest) Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse) 'Take a look at.>> MessageBox.Show(response.StatusCode.ToString) If response.StatusDescription = "OK" Then MessageBox.Show("You are now logged in as user " & TextBox5.Text) Me.Button1.Enabled = True Else MessageBox.Show("Login failed!!") End If Catch ex As Exception MessageBox.Show("The site is down, please try again later") Me.Button2.Enabled = True End Try End If End If End Sub End Class


Rispondi quotando