0

Possible Duplicate:
How to elevate privileges only when required?

After much debugging, turned out my application on a different computer was not working because it needed to run with administrative privileges (I have everything run as administrator on my computer). Rather than prompting for them, it threw an exception. I do direct sector access to disk in my application.

How do I get it to automatically show the 'run as administrator' when it needs it?

thanks..

Community
  • 1
  • 1
reza
  • 1,329
  • 2
  • 22
  • 37
  • Here's an option on how to do it at runtime (though it does restart the process in order to acheive this): http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/84fbf8df-aaa4-41f2-be1c-07238a0ca28d. Another option would be to put anything requring admin rights into a separate process and kick that off from your main program/process. – JohnLBevan Nov 28 '12 at 23:39

1 Answers1

1

Look into adding an application manifest to set the required privileges to administrator. See here: How do I force my .NET application to run as administrator?

Community
  • 1
  • 1
rae1
  • 6,066
  • 4
  • 27
  • 48