none
Access to the path "...\Local\Temp\.....exe" is denied!

    Question

  • Ok, i have created an autoupdate system for my software. I download new version to \Local\Temp\ folder. And no problems occurs. But if i try to start .exe file that i downloaded, i get error "Access to the path 'C:\Users\xxx\AppData\Local\Temp\updater.exe' is denied." The code that i use is:

     

    ProcessStartInfo upgradeProcess = new ProcessStartInfo("updater.exe");
    upgradeProcess.WorkingDirectory = System.Environment.ExpandEnvironmentVariables("%TEMP%");
    <br/>
    Process.Start(upgradeProcess);
    

    What steps i should take to eliminate that problem?

    Thanks in advance!

    Friday, November 05, 2010 10:23 AM

Answers

All replies

  • Has the code that downloaded the updated file still got it open? Did you call Dispose() or Close() on the download stream?
    Friday, November 05, 2010 10:31 AM
  • Friday, November 05, 2010 10:37 AM
  • Yes, the webclient that downloads the file is disposed before i try to run it!

    Actually. Sorry, the exe file is not downloaded. exe file is copied from "program files" to temp. (.msi is downloaded)

    exe file start the msi which is in temp folder. but i can't start exe file!

    Friday, November 05, 2010 10:38 AM
  • I tried Path.gettemppath, but everything stays the same! access denied.
    Friday, November 05, 2010 11:10 AM
  • Hi Peacelyk,

     

    Thank you for posting.

     

    Based on your description, please check if update.exe has been set Read-only. This can cause an access denied exception to be thrown.

     

    If you wouldn’t like to use ClickOnce to update your clients’ app, you could refer the following link that is very detail and useful links. http://digitalformula.net/articles/c-self-updating-application-without-clickonce

     

    Regards,

    Larcolais


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Larcolais Gong Friday, November 12, 2010 5:14 AM
    Tuesday, November 09, 2010 8:39 AM
  • Hello
    I am also facing same issue like Access Denied with the path in windows server 2008 R2 ("C:\\Program Files\\wkhtmltopdf1\\bin\\wkhtmltopdf.exe", args),But this path works in local system both local and live server (windows server 2008 R2 Enterprise) having same IIS version (7.5).Getting Access Denied at Proc.start() in below code for windows server 2008 R2 Enterprise.

    protected void Export(object sender, EventArgs e)
        {          
            String GlobalDomainName = System.Configuration.ConfigurationManager.AppSettings["live_domainName"];

            string url = "PropertyEWC.aspx?id=" + PropertyId + "&bid=" + UserData.BranchId + "&aid=" + UserData.CompanyId;


            string args = string.Format("\"{0}\" - ", GlobalDomainName + url);
            var startInfo = new ProcessStartInfo("C:\\Program Files\\wkhtmltopdf1\\bin\\wkhtmltopdf.exe", args)
            {

                UseShellExecute = false,
                CreateNoWindow = true,
                RedirectStandardOutput = true

            };
            var proc = new Process { StartInfo = startInfo };
            proc.Start();
            string output = proc.StandardOutput.ReadToEnd();
            byte[] buffer = proc.StandardOutput.CurrentEncoding.GetBytes(output);
            proc.WaitForExit();
            proc.Close();
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Disposition", "attachment;filename=ElectronicWindow.pdf");
            Response.BinaryWrite(buffer);
            Response.End();
        }


    I had tried your above post in my server but doesn't worked out for me.Looking forward to hearing from u 




    18 hours 36 minutes ago