0

因为我正在制作一个程序,所以我想向它添加一个应用程序更新程序。我在这里搜索(通常我从其他主题中找到我的答案)但是这个返回没有,就像我的问题一样。:D

我正在使用这段代码:

Private Sub worker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles worker1.DoWork
   Try
      Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://nighthawk1037.comze.com/apps/gmailbomber/currentversion.txt")
      Dim response As System.Net.HttpWebResponse = request.GetResponse()
      Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
      Dim newestversion As String = sr.ReadToEnd()
      Dim currentversion As String = Application.ProductVersion

      If newestversion.Contains(currentversion) Then
         MessageBox.Show("You have the current version", "Update Check")
      Else
         MessageBox.Show("A Newer version is available! Gmail Email Bomber will attempt to download and run the new update!", "Update Check")
         My.Computer.Network.DownloadFile(New Uri("http://nighthawk1037.comze.com/apps/gmailbomber/update/gmail_email_bomberv1-beta2.exe"), "C:\Program Files\gmailbomber\gmail_email_bomberv1-beta2.exe", "", "", True, 60000, True, FileIO.UICancelOption.DoNothing)
         Process.Start("C:\Program Files\gmailbomber\gmail_email_bomberv1-beta2.exe")
         Me.Close()
      End If

    Catch ex As Exception
      MessageBox.Show(ex.Message)
    End Try
End Sub

要让我的 VB.Net 程序检查我的网站是否有 currentversion.txt,如果它是新的,它会下载最新版本。通常这在我离线尝试时有效(wamp服务器)但由于某种原因ex.message返回一条The remote server returned an error: (404 Not found).消息。这当然意味着目录/文件不在远程服务器上。但我已经确认了大约 10 次,一切都在我的网站上,链接正确,一切都应该正常工作,但由于某种原因,我得到了那个错误。是因为文件权限吗?

注意:我有一个.htaccess关于nighthawk1037.comze.com/apps它重定向到index.php同一目录中的文件并重定向到主页的位置,但我删除了它并仍然收到错误,现在我唯一.htaccess拥有的就是IndexIgnore人们无法检查文件。

4

0 回答 0