Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c#: how to request for admin priviledge

/*
1. To do request Admin priviledge, add an Application Manifest file to your project in visual studio.
2. Right click your project file on the Solution Explorer, select "Add", then "New item".
    There you can find Application Manifest File.
3. An app.manifest file will be added to your project.
4. In the app.manifest file, there is a <requestedExecutionLevel> element.
   Modify the "level" attribute of this element as shown in the comments :
*/

/*
<!-- UAC Manifest Options
             If you want to change the Windows User Account Control level replace the 
             requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel element will disable file and registry virtualization. 
            Remove this element if your application requires this virtualization for backwards
            compatibility.
 -->
 */
 
 <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

/*
5. You can set the "level" to either "requireAdministrator" or "highestAvailable".
*/
Source by social.msdn.microsoft.com #
 
PREVIOUS NEXT
Tagged: #request #admin #priviledge
ADD COMMENT
Topic
Name
9+1 =