.net – UnauthorizedAccessException : Getting in Vista

exceptionnetwindows-vista

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.

Best Answer

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.