Link to home
Start Free TrialLog in
Avatar of Mike Eghtebas
Mike EghtebasFlag for United States of America

asked on

Access denied, file/folder audit... c# vs2012

I have produced small application using http://msdn.microsoft.com/en-us/library/ms171645%28v=vs.80%29.aspx which functions well for certain folders but not all.

It works well for path like: C:\Users\Public\Documents\UntypeDatasetSample which there is no security requirements. But it doesn't work for most other folders because the security issues discussed at:  http://windows.microsoft.com/en-us/windows7/how-do-i-open-a-file-if-i-get-an-access-denied-message

Question: Is it possible to dynamically pacify the security and reinstate it after the files and folders have been audited?

If you wish to have a copy of this 60KB applcation, download it from: https://onedrive.live.com/?cid=420CDD6A13807C9B&id=420CDD6A13807C9B%21116
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

What happens if you right-click on the program name and select "Run as Administrator"?
Avatar of Mike Eghtebas

ASKER

I am running as admin. It errors as shown below:
User generated image
Above and beyond admin sign-in, the following link below seems to suggest the need to change security for folders being accessed.

http://windows.microsoft.com/en-us/windows7/how-do-i-open-a-file-if-i-get-an-access-denied-message

Public folder doesn't have security but My Music folder (by default) has in windows 7.

Mike
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As you are describing, I have too, to use run as admin when it is needed. This application is for learning at this point. As we know users will not have admin rights and that is good (they will not be able to view the content of certain folders they are not allowed to). But as admin, I do not want to manually change each and every folder just to audit them and then go back to restore their security. I am hoping for a dynamic solution.
Yes... but did you try "Run as Admin" to see if the program you are working on works in your 'admin' account?  I doubt that you will find "a dynamic solution", especially for regular non-admin users.
re:> but did you try "Run as Admin" to see if the program you are working on works in your 'admin' account?
A folder is nothing to run as. I am able open My Music folder manually but the code I am running, is not able to open it to read its content despite the fact I have logged as admin prior to running  this code.

re: especially for regular non-admin users
This is good, because non-admin users are better to be limited to only the folders they are allowed to view.

re:> I doubt that you will find "a dynamic solution"
All I can do is to keep asking around. I think, I better include some other TAs such as operating system or those heavily involved with security issues.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial