Creating a file in Windows 7 from C# WinForms application
I have a WinForm application which is generating CSV files. I give the user the option of choosing the path in which to save these CSVs.
The user is using Windows 7 and is logged in as admin. When he tries to save the CSVs by way of the application, there is an error "permission denied".
The application that is having the issue in particular is the console app. We are creating a scheduled task, and the task is specified to start the process as his administrator account. However will have issues whe开发者_开发问答n the application tries to save a file to the specified folder(to which his username has permission to write to).
Is there a way to allow an administrator of the machine to create folders/files anywhere he has permission to via the application?
Thank you!
You can either turn the UAC off or require the process to run in an elevated context.
In general, you should not worry about it unless your application is specially tailored for altering administrative stuff in the system, you should let the user decide to run it in elevated mode.
精彩评论