---
title: "How can I force my .NET application to run as administrator in C#?"  
description: "How can I force my .NET application to run as administrator in C#?"  
author: "Steilla Mitchel"  
published: 2023-07-12  
updated: 2023-07-13  
canonical: https://www.mindstick.com/forum/159059/how-can-i-force-my-dot-net-application-to-run-as-administrator-in-c-sharp  
category: "c#"  
tags: ["c#", ".net", ".net framework"]  
reading_time: 2 minutes  

---

# How can I force my .NET application to run as administrator in C#?

How can I force my .NET [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) to run as administrator in C#?

## Replies

### Reply by Aryan Kumar

Sure, there are two ways to force your .NET application to run as administrator in C#:

## 1. Modify the application manifest

The application manifest is a file that contains information about the application, such as its name, version, and requested execution level. You can modify the application manifest to force the application to run as administrator by changing the `requestedExecutionLevel` value to `requireAdministrator`.

To do this, open the application manifest file in a text editor and change the `requestedExecutionLevel` value to `requireAdministrator`. For example, the following code shows how to modify the application manifest to force the application to run as administrator:

XML

```plaintext
<requestedExecutionLevel level="requireAdministrator" />
```

Once you have modified the application manifest, you will need to rebuild the application. After the application has been rebuilt, it will always run as administrator, regardless of the user account that is used to run the application.

## 2. Create a shortcut with the "Run as administrator" option

You can also force your .NET application to run as administrator by creating a shortcut with the "Run as administrator" option. To do this, right-click on the application shortcut and select "Properties". In the "Shortcut" tab, click on the "Advanced" button and check the "Run as administrator" checkbox.

Once you have checked the "Run as administrator" checkbox, the shortcut will always run the application as administrator, regardless of the user account that is used to run the shortcut.


---

Original Source: https://www.mindstick.com/forum/159059/how-can-i-force-my-dot-net-application-to-run-as-administrator-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
