I have this code for start application after download
client.DownloadFileAsync(new Uri("http://mysite/myapplication.exe"), tempPath + "\\" + sDownloadFileName);
try
{
string tempPath = System.IO.Path.GetTempPath();
Process.Start(tempPath + "myapplication.exe");
Application.Exit();
}
catch
{
MessageBox.Show"Error, the file is corrupt");
}
but if the file (http://mysite/myapplication.exe ) it doesn’t exist..
a file is created the same 1KB, start and return error =(
is possible block the execution file if it is small of 10 MB ?
try
{
string tempPath = System.IO.Path.GetTempPath();
if (tempPath + "myapplication.exe" == -10 MB)
{
MessageBox.Show"Error, the file is corrupt");
}
else if
{
Process.Start(tempPath + "myapplication.exe");
}
}
use
FileInfoto check the size after downloading.