我正在尝试使用文件制作一个简单的登录系统
Dim response As System.Net.HttpWebResponse = request.GetResponse()
If response.StatusCode = HttpStatusCode.NotFound Then
MsgBox("Invalid Login")
Else
My Code Here
但是当我调试它并测试它时,它仍然给我 404 错误。而不是弹出窗口。
还有其他方法吗?
编辑:
这是我的代码
Try
Dim response As HttpWebResponse = request.GetResponse()
MessageBox.Show("Allgood")
Catch ex As WebException
If response.StatusCode = HttpStatusCode.NotFound Then
MsgBox("Invalid Login")
End If
End Try
Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
Dim passcheck As String = sr.ReadToEnd
Dim pass As String = PasswordTextBox.Text
If passcheck.Contains(pass) Then
MessageBox.Show("Welcome " + UsernameTextBox.Text)
Form1.Show()
Me.Close()
Else
MessageBox.Show("Invalid Login")
End If
End Sub