0

I'm getting a quite common exception: Access to the path 'C:\inetpub\wwwroot\Content\Images\Uploads\<there goes my hashed guid as a subfolder name which is created dynamically>'

I'm using IIS Express 7.5. I'm using WA authentication in my application. Impersonation's disabled both in web.config and on IIS.

I looked at application pool the site is running (which is ASP.NET 4.0). Application pool identity: Network Service. I have given full control rights to the Uploads folder for IIS AppPool\ASP.NET 4.0. Also did this for authenticated users. Checked I did this for subfolders.

EDIT

Helped a little http://forums.asp.net/t/984207.aspx/1

I have created the folder: C:\inetpub\wwwroot\Content\Images\Uploads. It wasn't present on my C drive before). Then I added full control permissions for Network Authority on the folder and successfully uploaded a file to the path.

So I'm just curious where should I keep my project folder? Now I keeping it on other drive, not C.

EDIT

Ok. I understood. All this is connected to my code where Server.MapPath is called.

Thanks!

lexeme
  • 2,915
  • 10
  • 60
  • 125

1 Answers1

1

You must give permission to the Uploads folder for NetworkService witch is the ASP.NET 4.0 identity.

Özgür Kara
  • 1,333
  • 10
  • 22
  • I use `Network Service` identity because when switched to `ApplicationPoolIdentity` it thows exception on accessing a database requested by login (`ASP.NET 4.0`). – lexeme Apr 12 '12 at 07:30
  • I don't know for sure: see when I assigned permissions (`FullControl`) to the folder I checked that it's applied to all files/subfolders, but subfolders created dynamically and their names are based on some hashed database records. Who knows maybe that's the culprit? – lexeme Apr 12 '12 at 07:39
  • by default sub folder will inherits permissions from parent. I think when you get error your sub folder must be exist, you can check then. – Özgür Kara Apr 12 '12 at 07:45