【发布时间】:2014-02-09 08:07:30
【问题描述】:
我正在创建桌面应用程序,当我在 TextBox1 和 Button1.Click 事件中写入用户名时,它应该检查网络上的文件夹是否存在。
到目前为止,我已经尝试过:
username = Me.TextBox1.Text
password = Me.TextBox2.Text
Dim dir As Boolean = IO.Directory.Exists("http://www.mywebsite.com/" + username)
If dir = true Then
Dim response As String = web.DownloadString("http://www.mywebsite.com/" + username + "/Password.txt")
If response.Contains(password) Then
MsgBox("You've logged in succesfully", MsgBoxStyle.Information)
Exit Sub
Else
MsgBox("Password is incorect!")
End If
Else
MsgBox("Username is wrong, try again!")
End If
第一个问题是我的布尔值给出了 FALSE 作为答案(目录确实存在并且所有权限都被授予查看文件夹)。我试图通过设置dir = false 来解决这个问题,然后我进入第一个 IF(但这不是我想要的,因为它应该是 TRUE,而不是 FALSE)
我们来到第二个问题,在这一行:Dim response As String=web.DownloadString("http://www.mywebsite.com/" + username + "/Password.txt") 我收到此错误消息:The remote server returned an error: (404) Not Found.
有没有比这方面经验更丰富的可以帮帮我?
【问题讨论】: