Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6784509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:00:13+00:00 2026-05-26T17:00:13+00:00

Possible Duplicate: How to force C# App to run as administrator on Windows 7

  • 0

Possible Duplicate:
How to force C# App to run as administrator on Windows 7

I am building a WinForms C# appliction, and I need it to ask for administrator privileges so I can copy and open directories in C:\.

Is this possible?

The code I am going to use (if any one needs) is this:

if (!Directory.Exists("C:\\smm"))
{
    Directory.Create("gg");
}

Or something like that, but I am sure I need administrator privilege.

Anyone know how I can do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:00:14+00:00Added an answer on May 26, 2026 at 5:00 pm

    You need to enable ClickOnce security settings in your project, then change the application manifest to require administrator privileges. This will cause Windows to show a UAC elevation prompt when the process starts, so the user can escalate your program to admin.

    To enable ClickOnce, go into your project’s properties, select the Security tab on the left, then check the “Enable ClickOnce Security Settings” box. Then go into the project’s “Properties” directory, and open up the app.manifest file. In that file, there’s a line that sets the required privileges:

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

    You can make it require administrator privileges like this:

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

    That’ll make it require admin when the process starts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How to force C# App to run as administrator on Windows 7
Possible Duplicate: Forcing Garbage Collection in Java? Can I Force Garbage Collection in Java
Possible Duplicate: Can I run a .NET garbage collection from WinDbg? I'm debugging a
Possible Duplicate: CSS: how can I force a long string (without any blank) to
Possible Duplicate: Javascript force open a link in a browser I am working on
Possible Duplicate: Mobile site - force landscape only / no auto-rotate I have seen
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Objective C for Windows iPhone development on Windows Is there any way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.