What determines Authentication for a folder in IIS? - asp.net

I have a folder under a web site that causes a request for authentication whenever I try and access it or any of its sub-folders. In IIS, 'Authentication' only has Anonymous enabled, and '.NET Authorization Rules' is set to 'Allow all Users'.
What could make IIS request authorization when I try and access this folder? Is there anything in the web app that could cause authorization to be requested?
This is IIS 8 under Windows 8. The application was developed under Windows 7 and transferred to Windows 8.

Anonymous Authentication uses an identity to access files on disk. You can check what identity by right-clicking Anonymous Authentication in IIS and selecting Edit... It is probably using IUSR (that is the default).
You have 3 options:
Give the IUSR account or the IIS_IUSRS group permission to access the folder
Set a different specific user that has access
Set Anonymous Authentication to use the application pool identity, then grant this (virtual) account permissions to access the folder

Related

Allow Anonymous Access to a single file in IIS

Following some internal documentation it says in IIS, go and allow Anonymous Access to some file.
So in IIS I found the folder and file in it, selected the file and clicked on Edit Permissions, but still can't find "Anonymous" to add it. Where can I find Anonymous?
I am on IIS 7.0, Windows 7
Since IIS 7, the user IIS uses to perform actions as when an anonymous user uses a website is the account named IUSR.
That is, unless the account used for anonymous authentication has been changed.
You will need to give read permissions to the same identity that your application's app pool is running under. If you are using the default app pool with the default settings, you can follow the instructions in this post IIS7 Permissions Overview - ApplicationPoolIdentity

Cannot get Orchard CMS site to load on Network Solutions Windows Hosting

I get the following .NET error when trying to load my Orchard CMS website:
Access to the path '\\.........\www\App_Data\Dependencies\Lucene.dll' is denied.
Exception Details: System.UnauthorizedAccessException: Access to the path '\\WDP\DFS\30\7\4\5\3024678547\user\sites\5481517.site\www\App_Data\Dependencies\Lucene.dll' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
How do I actually go about granting access rights? I've googled and found I should go into the server and right-click on the directory and edit the properties. BUT, I am in a shared hosting plan and don't think I can do that.
Am I pretty much at a dead end?
Things I've tried:
Setting file permissions through FTP, but I get a:
500 'SITE CHMOD 777...command not understood
I've downloaded and installed IIS Manager and successfully connected to my site, but still did not find any options to set permissions in there.
I've also called Network Solutions, but all I was told was to try to do the file permissions settings (as I mentioned above).
Thanks in advance.

IIS_IUSRS Identity for a website

I am using IIS7 to host an asp.net 2.0 site. However, whenever I browse it I get the error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Now I realize that this is because the IIS_IUSRS does not have access to the web.config. My question is how can I grant access to IIS_IUSRS
When I look under Application Pools and check the Identity. It shows
ApplicationPoolIdentity(default), LocalService, LocalUser and Network Service
However, I cannot seem to find IIS_IUSRS
Where do I find it
IIS_IUSRS is actually a Windows group so you won't find it under the application pools in IIS.
If you need to grant this group access, then this will need to be done via the file system, e.g. you could go to the folder where you have deployed your ASP.NET application and grant permissions to the group:

Access to the path '0' is denied IIS 7

I have a web application developed in ASP.net 4.0 and hosted in IIS7(ProdServer).
In one of the pages I am creating a file and storing it in \someOtherServer\Storage\
folder.
when I log on to production server and hit run and \someOtherServer\Storage\
I am able to browse the folder.
When I run my ASP.net application I get the error
Access to the path '0' is denied.
Exception Details: System.UnauthorizedAccessException: Access to the path '0' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
You will have to look at the identity of the apppool under which your ASP.net site is running and make sure that account has permissions to the resource on the other server.
To do this in IIS 7, do the following:
Open IIS manager and browse to the site where this is happening.
Right click on the site and select Manage Application -> Advanced settings.
The top most setting will show the name of the application pool you are running under. Most probably it is DefaultAppPool, but it could be something else too (preferably it should be something else).
Now cancel and click on the Application Pools node in IIS manager and right click on the application pool you saw above and select advanced settings.
Look at the Identity setting under process model - this might be ApplicationPoolIdentity. For you to access a resource on another machine you will have to run it either as NetworkService or as a domain account. I suggest you try the one and then the other. The domain account should be a service account which password does not expire (otherwise every time it expires you will have to retype it in here). Make sure that the domain account has access to the shared resource on the remote server.
Hope that helps someone.

Windows Server 2008 - Give my ASP.NET website write permission to a folder

I have a folder "foo" which resides under the root folder of my ASP.NET website.
My ASP.NET website has a file browser control which enables (authenticated) users to upload files, create folders, move folders, delete file/folders etc. in the "foo" folder.
What permissions should the "foo" folder have?
It is a Windows Server 2008 / IIS 7 box.
Many thanks.
Depending on the authentication method you are using, either the end user or the Application Pool Identity user will need Modify privileges to the foo folder.
UPDATED:
It sounds like you are using Anonymous Authentication, but are authenticating the user in your DB via your application.
Check your IIS to determine which identity Anonymous Authentication is using. The default is IUSR, but you can also decide to use the application pool identity, in which case, you will need to check your Application Pool Identity.
If you have stuck with the defaults, you will likely only need to add Modify permissions to the built-in IUSR user.
Additional backround info: Understanding Built-In User and Group Accounts in IIS 7

Resources