Privilege Admin for one method

Im currently working on ApplicationLauncher / Autoupdater. Therefore, to install / update the application in "Program Files" I need to request administrator rights.

Well, since Updater only needs to write something if new Versions are found, I tried only to request privileges if a new version is found.

The updater runs every time before the application starts, so the "everytime" request for Adminrights is not a solution ...

I searched a lot and found the following:

[PrincipalPermission(SecurityAction.Demand, Role = @"Administrators")]
    private void InstallOrUpdate(AppItem appItem)

but wenn I'm trying to do this, updater throws a SecurityException ...

The primary user permission request failed.

What am I doing wrong?

Regards, dognose

+5
2

. "", .

, , InstallOrUpdate, ( , ) .

+3

UAC - , .. , . , , , - . .

+2

All Articles