Since Vista & windows 7 came out some of my .NET application has started throwing security exceptions.
I’ve noticed that some applications (i.e. my antivirus, control panel) have a small shield and when I run these applications administrator privileges are automatically requested from me by windows.
I know that as a user I can set the application to run as administrator but that’s not good enough because if the application will run without privileges it would crash on my users machines.
Is there a way to tell windows (programmatically) I want the application to run with administrative privileges?
You need to mark your app as requiring admin privileges in the application manifest. Here’s an article from MSDN Magazine that explains the process.