C # The application runs as an administrator

Source: Internet
Author: User

Vista Windows 7 uses UAC to control program access. For programs that need to run as administrators, right-click and run as administrators.

C # in programming, the program can run automatically as an administrator, that is, we often see a shield on some program icons.

Find app. manifest in the properties directory of the source code,

Change level = "asinvoker" to level = "requireadministrator,

If no app. manifest file exists, you can open the project properties, locate the security item, and enable clickonce security settings. The app. manifest file is generated,

Then remove the check box.

In this way, you re-compile the program, and a small shield will appear on your program icon. Then, you will automatically run your program as an administrator without right-clicking it.

 

If you cannot see the little shield, the notification may be set to "never notice" in "User Account Control Settings ". You can see it by default.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.