Using the following sub to download a file I receive an "Access to the path 'path' is denied" no matter where I try to download it to even if I run the program as an administrator.
Why do I get an access denied error?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("HLDSUpdateTool is Copyright © VALVe Corporation. We are not affiliated with VALVe Corporation in any way.", MsgBoxStyle.Exclamation, "Copyright")
MsgBox("Select where you would like to download this file to.", MsgBoxStyle.Information, "Download")
Dim FolderBrowserDialog1 As New FolderBrowserDialog
With FolderBrowserDialog1
.RootFolder = Environment.SpecialFolder.Desktop
If .ShowDialog = DialogResult.OK Then
End If
DownloadFile("http://storefront.steampowered.com/download/hldsupdatetool.exe", .SelectedPath)
hldsupdatetool = .SelectedPath & "\hldsupdatetool.exe"
My.Settings.HLDSUpdate = .SelectedPath & "\hldsupdatetool.exe"
My.Settings.Save()
My.Settings.Reload()
If My.Computer.FileSystem.FileExists(.SelectedPath & "\hldsupdatetool.exe") = True Then
MsgBox("HLDSUpdateTool successfuly downloaded to """ & .SelectedPath & """.", MsgBoxStyle.Information, "Download")
Else
MsgBox("An error occurred downloading HLDSUpdateTool.", MsgBoxStyle.Exclamation, "Download")
End If
End With
End Sub