Migrating a Winforms app to Vista the right way RRS feed

  • Question

  • Hello. We have a .Net 1.1 Winforms app that is several years old and which runs fine on Vista from an admin account. However, a client is restricting access to applications, and our app must be able to install and run from user accounts. Doing this with our application shows repeated UAC dialogs, which floor staff will not be able to answer.

    I have investigated running Winform apps under Vista, and my book and internet searches return articles on how to install an application as Administrator, or how to elevate privileges programmatically. I do not want to do this, our application does not need to run as administrator. If some features cannot be done by normal users, the client is prepared to create a policy or special account with those specific features, but not to elevate the app to administrator.

    Is there a book or guideline for writing Winform applications to install and run under user access? The MSDN Windows Forms Security site http://msdn.microsoft.com/en-us/library/aa983766(VS.71).aspx is not helpful because it either recommends elevating privileges, or does not implement necessary behavior. Some of the features we need to implement:
    • Installing the application from a downloaded .MSI under a user account.
    • Updating the installed application from a user account.
    • Downloading files via HTTP to a common local folder available to any logged-in user.
    • Opening and deleting the files in this common folder while running as any user.
    • Saving files to UNC or mapped folders.
    • Printing.
    • Cutting and pasting data from other applications.
    We are able to compile the app under VS2008/.Net 3.5, but it is not feasible to rewrite the app. We need to refactor it to avoid doing things that require admin privileges where possible, and permit specific actions if necessary.
    Wednesday, December 3, 2008 7:45 PM

All replies

  • Change the installer to install to a per-user directory under %localappdata%\Programs\ (that should fix most issues)

    Use the %public% directory for shared documents


    Chances are, unless you have code attempting to modify HKLM, that'll do the trick.

    Thursday, December 4, 2008 5:29 AM