Might I suggest using the TEMP directory, rather than the C drive? I use similar code for the same purpose:
Code:
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Diagnostics.Process
Dim CurrentVersion as String = "1.0.2"
Private Sub UpdateCheck()
'Download the text file
Dim LocalFile As String = Path.GetTempFileName
DownloadFile("http://www.website.com/version-latest.txt", LocalFile)
'Read the text file and get the current version
Dim Reader As TextReader = New StreamReader(LocalFile)
Dim LatestVersion As String
LatestVersion = Reader.ReadToEnd
Reader.Close()
'Compare the numbers and ask to update (if appropriate)
If Not LatestVersion <> CurrentVersion Then
If MsgBox("You are currently running an outdated version of <PROGRAM NAME>. Would you like to update?", MsgBoxStyle.YesNo, "PROGRAM NAME") = vbYes Then
DownloadFile("http://www.website.com/Program-" & LatestVersion & "Update.exe", Path.GetTempPath & "Program-Update.exe")
Start(Path.GetTempPath & "\Program-Update.exe")
File.Delete(LocalFile)
End
End If
End If
'Delete the temporary text file
File.Delete(LocalFile)
End Sub
It allows them to decide if they want to update or not, and clears all unused things afterwards. Though I should really learn regex at some point...
(oh yeah, I just call UpdateCheck when the program starts up.)