Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello.

I am trying to write a Control that displays all files and folders in a specified directory. If a folder throws an UnauthorizedAccessException, I can't display that folder in my Control.

I have heightened the running permissions to administrator, and have employed code that confirms that I am running the program as an administrator.

Is there a different way I have to elevate my rights programmatically that I am missing?

Thanks.
Posted
Updated 12-Feb-10 12:20pm
v2

You shouldn't elevate permissions programatically (and I don't think Windows will allow it).
 
Share this answer
 
There are a lot of reasons that you shouldn't show a folder if you get an UnauthorizedAccessException. Why would you want to? If you're user Jack, you want that user to be able to see the files in Judy's namespace?
 
Share this answer
 
Comments
Derek R. White 28-Jun-10 21:23pm    
If Jack is the administrator, Judy is a regular user, and Jack can't see what Judy has been up to, there is a problem.
If I'm user Administrator, I'd want everyone's everything.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900