Search code examples
asp.netasp.net-mvciiswindows-authenticationapplication-pool

How to grant rights properly to a folder on IIS 7.5 Express


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!


Solution

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