Very often you get "Access Denied" error messages in your .NET application and you wonder why it is throwing up and how do you troubleshoot it?? Here we will discuss the 1-2-3 steps for how to use Filemon/Regmon to troubleshoot Access Denied error messages?
So, first of all you need to download two tools called File Monitor and Registry Monitor
--- Download Filemon from http://www.microsoft.com/technet/sysinternals/utilities/filemon.mspx and
--- Download Regmon from http://www.microsoft.com/technet/sysinternals/utilities/regmon.mspx
--- Run Filemon and Regmon and reproduce your error
--- Once the error is reproduced, you need to Open Filemon and Regmon one by one and click on File -> Capture Events (or press CTRL + E) to check it Off. By default, it is on and it captures everything. CTRL + X clears the complete logs in the Filemon & Regmon
--- Now, save the Filemon and Regmon logs and open them in Excel (right click on the file -> Open With MS Excel)
--- In the Excel window select the menu, Data -> Filter -> Autofilter
--- Drop down column F and see if you have any Access Denied listed (select it if you have!)
--- At this point you should be seeing only those rows which contains Access Denied. Column E will show the resource and Column G will show you the account on which the Access Denied has been thrown.
--- Grant the permissions accordingly and try reproducing the issue. There is a high probability that your issue would be fixed. (You might need an IISReset or Reboot depending on the resource)
NB: It is not necessary that you run filemon and regmon simultaneously.