file Access problem

looc

Member
Joined
Jan 4, 2008
Messages
8
Programming Experience
Beginner
Hi.

I need to enable my application to access the c:\users directory on vista machines.
I´m writing a profile-cleaner program and need to be able to access and delete files in the c:\users directory.

Problem is that i get Access denied even trying to print subdirectories.

Runing a command line as both elevated and not elevated and doing a dir c:\users /s is working.
Bu when i compile a console app with IO.DirectoryInfo and run it elevated or not it´s not working, access denied.

And then running rmdir /S /Q [username] is working as elevated.

How can i get my console app to access the users directories?

/bjorn
 
You will need to have access to those folders in order to access them. You can use some sort of impersanation in order to access the folders from within your application or give your windows user admin access over the entire PC. There are many ways that you can impersonate a windows user within an application. Possibly one of the more decorated forum users can explain the best way in VS2005 previously I have used the win32 API and some third party software for all of my impersonation needs.
 
Hi

The problem is that i´m a'ready admin on the machine.
If you read all of my post you will see that i have access to the files when running a DOS-window but not when running a .net console-app
 
Back
Top