views:

2945

answers:

2

I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception:

UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied."

I've been advised to use Process Monitor to help resolve this, but it's quite a complex tool, and I really don't have time to spend exploring it. Please can someone assist me and advise how to use PM to determine which user is trying to access the folder etc.

A: 

Not sure why you would want to use Process Monitor for access problem in file system.

Check that the directory has access permitted for the user which the application is running as at the point of the file IO call. If you are impersonating this would be the Network Service account. If you are impersonating, it would be the impersonating user.

Samuel Kim
+2  A: 

When PM starts it displays a filter dialog. Just click 'Reset' to use the standard filtering. This will generate lots of messages, and you are only interested in very few of them. Under Process Name, select a line with the process you want to monitor. Richtclick it and choose include . That limits the reported events to the ones of your app. In the toolbar, the three rightmost icons let you filter the sources: Registry access, file system access and process/thread events. Unselect registry and process/threads, since you only want to monitor file access. In the menu choose Options - Select columns. Under Process Management, check User Name.

Now try to reproduce the error. If you are still getting too many events, you can limit the path (rightclick in the Path column and choose exclude ). You can fine tune your filtering by clicking Ctrl-L, the interface should be self explanatory. (Oh, just remember to click Add before clicking OK when you want to create a new filter rule... I almost always fall for that particular trap ;-)

Treb