Accessing files in user appdata folder through

Feb 23, 2010
Reaction score
Hi All,
Is there a way to access user's appdata folder and files in it using c# code.?
I have a code in c# which gets users appdata path from a running process and from that process I am getting the process's file name using process.MainModule.FileName call.
After killing that process, I am trying to remove that process's executable from the user's application data folder where the file remains. It works fine for XP from system user account, but on windows 7 it throws exception regarding 'Cannot access the file specified' with some I/O error in my c# code...

I know with Vista or later OSs, microsoft has enabled UAC that is why I am not able to users appdata folder directly. but I want to remove/delete one file from appdata path. Can I get this done with c# code on windows??

Please let me know any system tweaks which can achieve this programatically.

thanks in advance..


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question