views:

75

answers:

1

Hello,

I've written an extremely simple program to load an xml from one path and store it in All Users/Application Data. But i'm getting access denied error. So i want to impersonate the admin account and save the file. How to do that?

Thank you.

Regards NLV

A: 

See this MSDN Article. for an example of impersonation. Another thought, wouldn't it be easier to just change the file's permissions? It is going to be able to be seen by everyone anyway. Also, you would have the added benefit of not having to secure the Admin password.

thedugas