runtime icon indicating copy to clipboard operation
runtime copied to clipboard

How to request administrator permissions at runtime

Open Luokun2016 opened this issue 4 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I want to ask for administrator permissions anycodings_runtime at runtime in my application, but I couldn't anycodings_runtime find anything, despite the googling and anycodings_runtime searching. I could only find posts regarding anycodings_runtime rights at startup, I found one but, it was anycodings_runtime valid for .NET Framework, I can't really use anycodings_runtime dNF, I am using .NET Core 3.1

Similar questions https://www.anycodings.com/1questions/482600/how-to-request-administrator-permissions-at-runtime

Describe the solution you'd like

image

After the user confirms, it continues to run in admin token

Additional context

No response

Luokun2016 avatar Aug 09 '22 12:08 Luokun2016

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

ghost avatar Aug 09 '22 12:08 ghost

@Luokun2016 it's not possible to elevate permissions of an existing process, the common workaround for only conditionally needing administrative permissions (where declaring it in the app manifest is not desireable) is to restart the app with admin permissions https://stackoverflow.com/a/7351689

Suchiman avatar Aug 09 '22 12:08 Suchiman

@Luokun2016 please let us know if @Suchiman 's suggestion will not work in your case.

jeffschwMSFT avatar Aug 09 '22 14:08 jeffschwMSFT

Works fine. Thanks.

Luokun2016 avatar Aug 11 '22 03:08 Luokun2016