-1

I have a small .NET application deployed using "Setup and Deployment" wizard. The problem is that when I run it with the user having administrator rights, it runs without any errors, and if the user doesn't have administrator rights then it gives the error

Application encountered an error and needs to close

When I check the error report, it says:

P9: System.unauthorizedaccess

I even checked the option "Install to Everyone", but to no use.

What might be the issue?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user698065
  • 277
  • 2
  • 4
  • 10
  • Start by writing an event handler for AppDomain.CurrentDomain.UnhandledException and log or display the value of e.ExceptionObject.ToString(). Now you can ask a real question instead of "it doesn't work, why?" UAC is the typical cause. – Hans Passant Jul 29 '11 at 15:40

1 Answers1

0

On Windows Vista and Windows 7, you need to run/install as administrator for certain applications. You can turn off UAC. See Turn User Account Control on or off.

The user can instructed to run as administrator if the user is not running as administrator. You can use the WindowsIdentity .NET class to get the user access level. See How to check if the logged on user is an administrator?.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131