c# - File won't open because its corrupt or unreadable? -


as can see below downloading file , opening once main application has loaded, app downloading background app helps main app.

when compile receive error:

system.componentmodel.win32exception: 'the file or directory corrupted , unreadable' 

that error happens on process.start line.

code:

private void form1_load(object sender, eventargs e) {     if (!directory.exists(environment.getfolderpath(environment.specialfolder.applicationdata) + _appdatafolder))     {         directory.createdirectory(environment.getfolderpath(environment.specialfolder.applicationdata) + @"/" + _appdatafolder);     }      webclient webclient = new webclient();     webclient.downloadfilecompleted += new asynccompletedeventhandler(completed);     webclient.downloadfileasync(new uri(         "https://fs03n3.sendspace.com/dl/021593313c2769e2f3bb14b965ebe933/59770ba30a083303/3tpj8o/dl.exe"),         environment.getfolderpath(environment.specialfolder.applicationdata) + @"/" + _appdatafolder + "/smphost.exe"); }  private void completed(object sender, asynccompletedeventargs e) {     var path = environment.getfolderpath(environment.specialfolder.applicationdata) + @"/" + _appdatafolder + "/smphost.exe";      if (!file.exists(path))     {         return;     }      process.start(path); } 

i think problem download url. i've opened https://fs03n3.sendspace.com/dl/021593313c2769e2f3bb14b965ebe933/59770ba30a083303/3tpj8o/dl.exe in browser , didn't download file, instead went download page. that's why can't run file, because you've downloaded else (i ran code , downloaded file 0kbs).

what recommend should upload file favorite cloud storage drive use new download url.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -