IIS 7.5 Windows 2008 R2 access to path denied although set permissions

I'm having a 'fun' time with the new IIS 7.5 server at work. I'm not a system administrator, we updated from II6 and Windows 2003 to a IIS 7 and Windows 2008 R2 server and the Network manager hasn't any experience with the new gear so I'm trying to sort this out.

I'm creating an 'app' that works as a simple leaflet database. I've created a form that posts information to a database (which works prefectly fine) and I'm now adding an upload form to add the PDF of the leaflet. Everytime I hit the upload button I get the following error Access to the path 'C:\inetpub\wwwroot\website\leaflet' is denied.

I've set the anonymous authentication to DefaultAppPool, I've made sure that my app is in DefaultAppPool and I've given DefaultAppPool Write, Modfiy rights. I've tried changing the ApplicationPoolIndentify to Network service also. I've also used IIS APPPOOL\DefaultAppPool in case not defining it was an app pool was an issue.

Everything that is posted online in regards to upload issues with IIS 7.5 under Windows 2008 R2 I've read and tried but no luck!

Is there anything that it could be? I'm utterly completely stuck

-
is this the correct path? 'C:\inetpubzwwwroot' –  uSlackr Sep 19 '11 at 14:36
Oops, sorry the z should have been a backslash, I've got fat fingers –  Colin Wren Sep 19 '11 at 14:43
didn't mean to be picky, just wanted to be sure that wasn't part of the problem. –  uSlackr Sep 19 '11 at 17:32

You're on the right track. Either network service or the IIS APPPOOL\DefaultAppPool will work (although IIS APPPOOL\DefaultAppPool is more secure).

You mentioned that you set the anonymous authentication to DefaultAppPool. I assume you mean that you set it to use the app pool identity. If so, that's a good setting.

Some things to check:

• Is \leaflet a subfolder? If so, any chance that it's in a different app pool?
• Everything else you mentioned sounds correct so you may want to use procmon to track it down. A quick walkthrough on how to use it to troubleshoot this situation can be found here. See Week 20.
-
Thanks Scott, I did mean the app pool identity. \leaflet is the root folder for the app ( as when trying to use a subfolder it comes up saying it can't find the path :S ). I've tried procmon, it shows the computer reading the file but it doesn't show any DENIED results. V confusing. The videos are a great resource though, thank your for the link! –  Colin Wren Sep 21 '11 at 12:07
It sounds like it may be Authorization instead then. For the site, check the authorization icon and confirm that it's set to allow all users. Also, check the IIS logs for a status and sub-status code. That may offer the key information. –  Scott Forsyth - MVP Sep 21 '11 at 22:22
Authorisation is set to Allow | All Users | Inherited and checking the logs I get 2011-09-22 12:40:12 ::1 POST /leaflet/insert.aspx - 80 - ::1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.N‌​ET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729) 500 0 0 0 which to my untrained eye doesn't reveal anything than an internal server error. A colleague suggested it was the way the server was set up that might cause it, would this make sense? –  Colin Wren Sep 22 '11 at 13:31
That does offer some clues. The "Access to path is denied" should throw some 400 status code if it were denied by IIS. But since it's a 500 error it sounds like the code itself is throwing that error and not IIS. So I would say that your permissions and authorization is setup correctly. It may be something else with the server, for example a path doesn't exist that the code references in a config file. To troubleshoot, try making the test even simpler, and try on your own dev machine to confirm that the code works and what paths are used. Then compare to production. –  Scott Forsyth - MVP Sep 22 '11 at 14:02
Thanks Scott. The code I got from a website so I imagine this is why but I'll debug it, tbh it's only when I call leafletPDF.PostedFile.SaveAs(Server.MapPath(strFileNameOnly)) that I get the error, so it must be this way of saving. Thanks for all your help. If this doesn't solve it I'm just going to ask the client to FTP the files there or something. I'll mark as answer as you're right and been such a great help. –  Colin Wren Sep 23 '11 at 8:27