"Force a .NET Application to run as administrator "
While working on a .Net app, I got a requirement to make the app to run as administrator.
The solution I found is as follows:
Step 1: Create your .Net Application.

Step 2: Now right click on the project and go to Add New Item.

Step 3: Select Application Manifest File.

Note:-> An Application Manifest is a XML file. It contains the description of all the assemblies which are bidden with the application at runtime.
Step 4: Now open the Application Manifest File and search for <requestedExecutionLevel>:
What you will see is as follows:
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
Now instead of "asInvoker" write "requireAdministrator" i.e.
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Now when you will start your app it will run as administrator.
Hope it helps..!
0 Comment(s)