i searched on internet not find exact answer. in application, have functionality copies files in folder (say pqr) location user wanted. location of source folder location of installed application (say c:\program files\abc\pqr). when user logged in machine 'administrator rights', user able use functionality. when user logged in machine having 'user rights' (non-admin user), functionality throws exception access c:\program files\abc\pqr folder denied. tried elevate user privileges using below attributes copy method:
[principalpermission(securityaction.demand, role = @"builtin\administrators")] [permissionset(securityaction.demand, name="fulltrust")]
i tried adding manifest file below changes:
<requestedexecutionlevel level="requireadministrator" uiaccess="false" />
but none of approach worked.
then installed application on d drive. , after when tried non-admin user functionality worked expected.
when application installed in c:\program files, functionality not working non-admin user.but after installing application location worked non-admin user.
so question is, possible give rights if c:\program files non-admin user programmatically in application or need have admin users using functionality?
changing manifest simple way elevate privileges. change in vs. bad practice require admin privileges regular software.
you can make program folder accessible users during install. example can made innosetup
permissions: users-modify
in[files]
group.if source files in
program files
, copy in location, problem in wrong file access when opening source files. open reading only.
Comments
Post a Comment