locked
Preventing Application Elevation in VB.NET RRS feed

  • Question

  • Hi all guru's I designed an application in vb.net 2005 while using Administrator account on vista.

    After compiling the application it start requesting for elevation during startup.

    I will like to prevent this, because the customer is complaning can any one help me out.

     

    Thanks 

    • Moved by spacewrangler Tuesday, September 28, 2010 3:38 PM (From:Building Development and Diagnostic Tools for .Net)
    Monday, September 20, 2010 4:20 PM

Answers

All replies

  • Hi,

    Thanks for your post. It's UAC that's functioning. Since the elevation prompt shows at the startup of your application, it's possible that your application has something like this in its manifest: requestedPrivilegeLevel="highestLevel".

    Application manifests are not new. Manifests were used in Windows XP to help application developers identify such things as which versions of DLLs the application was tested with. Providing the execution level is an extension to that existing application manifest schema. Please take a look at here for detailed explanation of this element.

    We could use the Manifest View Tool to check for that in the application manifest. Then we could use Microsoft Application Compatibility Toolkit to ship the application with the RunAsInvoker fix, which will make the application run with the same privilege level of the invoker. Please take a look at this page, it shows how to use this toolkit, especially the Creating a Shim/Fix Using Compatibility Administrator.

    Here is another tool that can generate and edit application manifest:

    Manifest Generation and Editing Tool, Graphical Client (MageUI.exe)

     

    For more background info, please take a look at this:

    The Windows Vista and Windows Server 2008 Developer Story: Windows Vista Application Development Requirements for User Account Control (UAC)


    Please mark the right answer at the right time.
    Thanks,
    Sam
    • Edited by SamAgain Tuesday, September 21, 2010 1:52 AM refine
    • Marked as answer by Martin_Xie Friday, October 1, 2010 8:45 AM
    Tuesday, September 21, 2010 1:43 AM
  • Please check this thread for detailed instruction about UAC and how to change UAC settings in Application Manifest File.

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

     

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/0f481926-0060-48c2-9dd6-6f3e93eb0cc9/


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, October 1, 2010 8:44 AM
  • Experienced the same issue.  I found out that Windows was elevating because the assembly information of my file had the word "update".  "update", "install", or "setup" are trigger words for automatic elevation in Vista or higher.

    In order for mine to work, I changed any reference that had "update" in it, but I believe the one that did it was goign to the Project-->Properties window and selected "Assembly Information". In the pop-up is a list of Assembly information.  I changed any reference from "update" to something else, and published the file again.  You can see it is successful when you put the file on a network location and it no longer has the yellow/blue shield by the application icon.  The other references I changed were the Assembly Name, Root Namespace, Solution name, project name, form names, etc.  Assembly and Root Namespace can be found under the Application tab under Project-->Properties, and the Solution, Project, Form name can be changed under the Solution Explorer by right-clicking on the name and choosing "rename".

    Before doing this: I checked my app.manifest.  Which can be accessed by going the Project-->Properties or right click in the solution explorer and right clicking on the project to see properties.  You will get a screen with many tabs.  One being the application tab which has a Option for "View Windows Settings".  I am using Visual Studio 2013 Professional.   Under the app.manifest, you are looking for the keyword (requestedExecutionLevel level = "asInvoker") If the "asInvoker is set to "requireAdministrator" or "highestAvailable", change this to "asInvoker".  You can see the other reply for other options on how to prevent the application manifest from requiring administrator rights.

    Tuesday, November 10, 2015 9:37 PM