this question is actually a duplicate of this one. I want to detect if my program is being run either with privilege elevation in Winows through UAC, or as root in Unix/Mono.
How can I do that in C#?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like the function below would take care of the Unix/Mono end of the question. Btw, I didn’t actually compile or run this, but you get the idea.