views:

77

answers:

2

Hi, I made a application and its working fine in XP, but getting UnauthorizedAccessException in vista. Basically I am creating a folder through code and writing a XML file in it.

Is there a way I can make the application run as administrator through code or something.

Thanks.

A: 

You need to mark your app as requiring admin privileges in the application manifest. Here's an article from MSDN Magazine that explains the process:

http://msdn.microsoft.com/en-us/magazine/cc163486.aspx#S8

Pedro
+1  A: 

To make an application perform a UAC prompt you need to add a suitable manifest to your application. VS2008 is aware of manifest files and provides support for them. Of course really putting this file in a user's directory would be better, but sometimes you can't avoid creating things where you need UAC.

blowdart