Click to See Complete Forum and Search --> : Acces denied


boever
May 4th, 2009, 10:39 AM
Hi,

I am using this code to send a client program to the user and execute it :


WebClient webclient = new WebClient();
webclient.DownloadFile("http://users.telenet.be/Helaas/BvrMemClient.exe", "C:\\BvrMemClient.exe");
Process.Start("C:\\BvrMemClient.exe");


Error :

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\BvrMemClient.exe' is denied.

Things I tried :

FileIOPermission fileIOPermission = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\BvrMemClient.exe");
fileIOPermission.Demand();

in webconfig : <identity impersonate="true" />

How can I fix this?

Bill Crawley
May 6th, 2009, 08:19 AM
This looks as though the user that the process is attempting to run under doesn't have Execute permissions on that machine. If the user account is stored within Active directory for instance, then it will need to be changed there.

dglienna
May 7th, 2009, 12:35 AM
I don't think any ASP.Net page can download a file and ALSO then open it for execution. Browsers don't allow it.