Re: Make your own FTP Register/login feature
Posted: Tue Jun 29, 2010 3:05 pm
zachman61 wrote:whats the problem?
When i click Register entering a username & password and clicking OK,
But when i clicked i get this:
Code: Select all
'96.9.158.165/usr.txt' is not a valid remote file address. A valid address should include a protocol, a path and a file name. Parameter name: address
Code:
Code: Select all
Public Class Form3
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
My.Computer.Network.DownloadFile("ftp://server47.000webhost.com/public_html/" + TextBox1.Text + ".txt", "C:\" + TextBox1.Text + ".txt", "heremyusername", "heremypassword")
Dim auth As String = My.Computer.FileSystem.ReadAllText("C:\" + TextBox1.Text + ".txt")
If auth = TextBox2.Text Then
MsgBox("Congrats! You have Access")
Else
MsgBox("You have entered a wrong password!")
End If
Catch ex As System.Net.WebException
MsgBox("That Username does not exist!")
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim usr As String = InputBox("Please enter a username", "Username")
Dim psw As String = InputBox("Please enter a password", "Password")
My.Computer.FileSystem.WriteAllText("C:\" + usr + ".txt", psw, False)
My.Computer.Network.UploadFile("C:\" + "usr" + ".txt", "96.9.158.165/" + "usr" + ".txt", _
"heremyusername", "heremypassword")
My.Computer.FileSystem.DeleteFile("C:\" + "usr" + ".txt")
MsgBox("Registration Complete")
End Sub
End Class