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

  • SEARCH
  • Home
  • 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 7860991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:31:03+00:00 2026-06-02T22:31:03+00:00

I wanted to have an application remove a targeted file from specified worksations. The

  • 0

I wanted to have an application remove a targeted file from specified worksations. The user executing the software would be an admin on the target machine so I used the following code for a test:

string strTarget = @"\\" + textBox1.Text + @"\C$\Temp\temp.txt";

            try
            {
                File.Delete(strTarget);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failure to delete: " + ex.Message);
            }

I then created a \Temp\Temp.txt file on both my own workstation and another test machine. I am an admin on both machines and can manually access and delete the file through the UNC path in question. When I ran the code debugger no exceptions are thrown, but the file doesn’t delete. I can’t figure our what is not happening for this to fail.

Is there anything I can check or any code I need to add? I’ve done a search on other questions, but I havn’t been able to find an answer yet.

  • 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-06-02T22:31:08+00:00Added an answer on June 2, 2026 at 10:31 pm

    If you’re running under Vista/7, your program is probably running under non-escalated priveleges. Make sure you either explicitly run your program as an administrator, or specify it in your project’s manifest file:

      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!--
          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" />
    
         If you want to utilize File and Registry Virtualization for backward 
         compatibility then delete the requestedExecutionLevel node.
    -->
        <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
      </requestedPrivileges>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a User and Post scaffolded in my rails application. I wanted to
I have Iphone application in which i wanted to use Non_Renewable subscriptions.As per docs
I wanted to have a feature in my Jommla based application, that when ever
We have used UI Automation for automating our application and wanted to move the
I have created an SMS application in .NET. I wanted that the application should
I have a label with style class test in my javafx application. I wanted
I have wanted to try GAE since launch, but coming from ASP .NET and
Hi I was wanted to do Application witch have a root template view with
I wanted to know that if i have installed an application in my iPhone
I have a PHP Yii application that uses an RSS feed reader. I wanted

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.