IIS7 Permission Denied - ASP File Write - iis-7

Unfortunately I don't have a whole lot of information on this.
I have a customer who has moved their site from an ancient system to IIS7 on Windows 2008 Server. Info about the error is below:
Error:
E:\wwwroot\sp\xxx\online_data.xls
Microsoft VBScript runtime error '800a0046'
Permission denied
/xxx/oat/exceldata.asp, line 52
Code:
49 response.write(server.mappath("online_data.xls"))
50
51 set fso = createobject("scripting.filesystemobject")
52 Set act = fso.CreateTextFile(server.mappath("online_data.xls"), true)
The only suggestion so far is to:
grant the application pool
(DefaultAppPool / Classic AppPool)’s
impersonated identity read and write
permission to the physical folder
which the asp page reside
Will look at this when I get access, but other suggestions would be appreciated.

The provided answer is correct, but I needed a little more detail on how to accomplish it. To make it really easy, follow the steps below. I was setting up an asp page counter on a sandbox system in our intranet.
Open Computer Management.
Drill down to the IIS server
Management
In the Connections pane, click on
Application Pools
In the Application Pools pane,
right-click on DefaultAppPool and
choose Advanced Settings. Look in
the Process Model section.
By default, the Identity property is
set to ApplicationPoolIdentity.
This is a built-in account.
If it's set to the default, then you
can use the built-in user
machinename\IUSR for your
permissions settings. I had to
specify the machine name because
this is a virtualized server, YMMV.
If it's not set to the default, use
that username for your permissions
settings.
Cancel out of the dialog and return
to Windows Explorer, to the folder
where you need to add permission.
Right-click to get Permission
settings.
Set up machinename\IUSR or the
non-default username you determined
in steps 6/7 above. Grant
permissions as needed.
This helped:
http://learn.iis.net/page.aspx/140/understanding-built-in-user-and-group-accounts-in-iis-7/

The suggestion is correct. If the path to the solution is not immediately obvious for whatever configuration reasons, try running procmon (filter on "online_data.xls") and see who's failing, why, and what user account they run under. Then check the ACLs.

I had a similar problem in Windows 7 and my solution was changing the Authentication. From IIS, select the site, go to Authentication, disable Anonymous Authentication and enable Windows Authentication.

Spent a bit of time with something similar. Even with the correct settings it wasn't working.
I then tried create the actual file first on the server. Turned out to be the trick that worked. Now my ASP page writes to the existing file no problem.
Must be something about creating a new doc from scratch that is another issue.

Related

What are the IIS 8 required NTFS Permissions?

This questions has been asked, A LOT, but I've yet to figure out a proper solution. I've got a Windows Server 2012 server with of course IIS 8. I'm setting up a very, very, simple website on it with an HTML file that has Hello World in it. On the folder for the website I have the following permissions set up:
SYSTEM (local account, Full Access)
Administrators (local group, Full Access)
FTP (domain account, Full Access)
NAME_OF_APPPOOL (virtual account, Full Access)
So, with all of these permissions I still get a 401.3 - Unauthorized error from IIS. What am I missing in all of this?
The only thing that's made the website accessible so far was a desperate attempt by putting Everyone with read-only permissions. I think we can all agree that's just dumb as far as security goes...
Update
This is what the Application Pool Identity is set to at the moment.
Check #5 to make sure the AppPool the site is using is actually set to use the Identity you are adding NTFS permissions for.
Specify an Identity for an Application Pool (IIS 7)
Open IIS Manager.
In the Connections pane, expand the server node and click Application Pools.
On the Application Pools page, select the application pool for which you want to specify an identity, and then click Advanced Settings in the Actions pane.
For the Identity property, click the ... button to open the Application Pool Identity dialog box.
If you want to use a built-in account, select the Built-in account option and select an account from the list.
So, since I was trying to access an HTML page (static content) it appears that IIS doesn't use the AppPool identity for static content... (double-U, T, and F?) So, to make it work you have to add IUSR as referenced here: IIS 8 401.3 with ACL and static content. Anyway, it works now, I'm just sooooo looking forward to the day when I put MVC on that site and it starts failing, again...

Hosting ASP.NET in IIS7 gives Access is denied?

I have setup a application in my IIS7 that uses .NET Framework 4.0 (runned by NetworkService) but when browsing the site I get this:
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.
Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to*
I have tried to give NetworkService full permission on the folder that holds the website (the one that the web application in IIS is pointing against) but I do still get the access denied?
Why?
I gave access to "IIS_IUser" but instead it should be "IUSR". That solved the problem.
For me, nothing worked except the following, which solved the problem: open IIS, select the site, open Authentication (in the IIS section), right click Anonymous Authentication and select Edit, select Application Pool Identity.
I had the same problem, I enabled "Anonymous Authentication" but it still did not work.
So I also ENABLED "Forms Authentication" Then it worked without any problems.
OS : Windows 7 & IIS 7
If you still have permission denied after adding IUSR & NETWORK SERVICE.
Add also IIS_WPG. The addition of this last user solved my problem.
For people who can't find those users:
when you're trying to add a user in security of the folder (properties of the folder), click on "Advanced" of the window "Select Users or Groups". Change the location to the computer name then click on "Find Now". You'll find those users in the list below.
If you're using Anonymous Authentication, IIS 7 will use the "IUSR" account for directory access (unless you've set it to use the app pool identity. If you haven't granted IUSR sufficient permissions on your site's folders and files, you'll get this error
For me in windows 7 it started to work only after I gave 'Read & execute', 'List folder contents', 'Read' permissions to site folder for both users
IUSR
NETWORK SERVICE
Tried most of the solutions here, but no luck. What worked for me was adding "Everyone" to the security permissions. Properties -> Security -> Edit -> Add -> Everyone. The given defaults were enough for me to regain access.
In the near future, I should probably figure out what credentials are being sent to the server so that I can give proper permissions. But I hope it helps someone!
In the Authentication settings for APP itself (IN IIS), see if you have anonymous enabled.
We need to create a new user ComputerName\IUSR by going to the website folder-->Properties--->Security--->Edit-->Add and give read access. This would work definitely.
This solution is for IIS7
I went round and round on this and it turned out to be improperly set default page. Hope this helps someone else avoid an hour of wasted time.
In my case running c:\windows\Microsoft.Net\Framework64\v4.0.30319\aspnet_regiis.exe /i resolved the 403 access denied issue.
Checking the Application Pool Identity in Anonymous Authentication and enabling Forms Authentication would solve problem for access denied error. 😁
After some thinking and a lot of of trial and error I found out that this error occurred because part of my web.config was encrypted and for some reason the key was no longer valid.
Re-encrypting the config section solved the issue.
After watching this tutorial :
https://www.youtube.com/watch?v=RbrZbHpXBTE&list=PLp1Emx1rT4z9YWLDXBjUwBb130qv2Zq2x&index=4&ab_channel=LearningProgrammingTutorial
I had the same problem using RDP ( windows server 2016 Datacenter )
i followed the tutorial above & enbaled my directory browsing options from the IIS internet infromation services manager.
what you want to do is to access your IIS manager , you can check out the tutorial above to learn how to access IIS manager if you have trouble acessing there , it was useful for me that's why I'm sharing then ... go to :
you should gave access to IUSER
( or application tool identity , depends or what you want to work with )
and your problem would be solved! :)
Also you need to check your firewall and TCP settings , if ping between two machines didn't work for you , you can check this out :
https://operavps.com/rdp-connection-issues/
It was due to WWWRoot directory security issue.
Simple solution is, Just copy applicatio folder to some other drive, Instead of "C:\Inetpub\wwwroot"
and then create a virtual directory for this new path. That's it.
If the IUSR user is already specified in Authentication and you're still getting this issue, it could be that your Directory Listing isn't enabled. Be sure to check that. That was the case for me.
This is what happened to me:
Get - Post is ok. Working well.
When I try to use Options verb, the server return error like that.
Then, beware with urlScan
I add OPTIONS verb to urlscan configuration .ini file, then everything works well.
To check if urlscan is installed or not, open your iis manager, and open ISAPI FILTERS url scan should appear at the list.
I was also facing the same issue,
Everything was normal all the rights were given to the user and for folder as well.
After many research i found that the wwwroot (Source code folder) was shared with some other user.
I stopped sharing and it worked like a charm.
I was facing this issue after pulling from remote master and adding to the appsettings on web.config.
I solved it by enabling Windows Authentication:
Click on the project and press f4
Make sure Windows Auth is enabled:

IIS - Required permissions cannot be acquired. Enabled "Full Trust" and Load User Profile on App Pool is "True"

Setup
There is an IIS 6 application running in a .NET 2.0 App Pool on Server-A. IIS 7 Server-B needs to host that same code-base under a different URL. I created a virtual directory under Server-B's website to the network path of the application on Server-A. I've enabled this virtual directory on Server-B as an application running in its own .NET 2.0 App Pool in Classic Mode. Both app pools run as the same domain account that has access to that folder.
Issue
When accessing the site from Server-A it works fine. Accessing it from Server-B however generates the infamous "Required permissions cannot be acquired." error.
I have been trying to find a solution to this problem for two days. The two most common solutions have been to check the CLR Trust level on the Server-B box or to set the Load User Profile property on the App Pool to "True". Since I have full administrative rights I set the Trust level to Full and set the profile sitting to "True". Strongly naming all the assemblies the application and throwing them in the GAC is not where I want to go.
I'm sure I'm just missing some configuration somewhere. Any ideas? Thanks.
We have had a similar problem once.
In our case the user that was the identity of the app pool have never logged on to the server. Therefore, there was no local user profile, therefore there was a problem when the system tried to use the profile.
As a test try and set the identity of the app pool to the admin account you use to log in with.
Manually verify that user can access that share. Try logging into windows as that user and then accessing that share (or fake it with something like a "runas /User:{Domain\UserName} net use {\server\share}").
Also try loading ShareMonitor wherever the files actually live. It should tell you what user account is trying to access a given share. It might not be the account you think it is. I cannot recall if it was this program or not, but I have used something very similar in the past to figure out a really odd permission problem.
That should determine if it is a file access problem. If it isn't, then all I can say is to make sure you have ASP.NET enabled (on windows server it is a separate option).
Also check out the file permissions on your "Temporary ASP.NET Files" directory. I've had to explicitly add users write access to that before to get things working.
in my case my IIS App Pool had LoadUserProfile=false, so it was not loading the profile of the app pool's Identify (a domain account). This caused this unable to acquire permissions even though my Webroot files/folders (including /bin) had correct permissions. Setting LoadUserProfile=true fixed the issue for my setup.
I would set that application pools identity attribute (in advanced settings) as administrator. That way, you application will work on the server, just like it works on the local setup.

Asp.net Account in windows 7?

I want to authorize the asp.net account to access some folders in my project.
However, I get this error::
System.UnauthorizedAccessException: Access to the path 'D:\ProgramingPart\FromYamn\WebExercise\WebExercise\AccordionImgs' is denied.
I am using win 7 so what is the name of the asp.net account that I should use?
This depends on a couple of things:
What identity is the application pool running as?
What IIS authentication method are you using?
If you are using IIS7 in Classic Pipeline Mode, what authentication method are you using for ASP.NET (see your web.config file).
Try running visual studio as Administrator.
Under Win7 the default IIS user is ApplicationPoolIdentity. This is somewhat confusing as it's not a real user account. In order to adjust the permissions you need to drop to the command line first and issue
icacls D:\ProgramingPart\FromYamn\WebExercise\WebExercise\AccordionImgs /grant "IIS APPPOOL\DefaultAppPool":(OI)(CI)(RX)
From there you can return to explorer and edit the permissions using the properties tab for the directory. Or you can simply type "IIS APPPOOL\DefaultAppPool" in the add users field in explorer, but I have a preference for icacls myself :)
Probably you want to add the permissions a bit further up the tree. In real shared hosting scenarios application pools tend to get their own, full user accounts, but Server 2008/Win7 added the app pool user so pools can be created, isolated without having to do that.
This worked for me:
On the folder of your application, which might be something like:
C:\Users\YourName\Documents\YourSite
or
C:\inetpub\wwwroot\YourSite
Right-click the folder, choose Properties, go to the Security tab.
You need to add IIS_IUSRS to this list, and probably give full control.
Then, in IIS Manager, assuming you've set up your project folder as an application here, click on your folder/application. Then click the Authentication option. Right click the Anonymous Authentication, and check the user identity. Mine is IUSR.
Go back to your folder security, and add this user, with full control too.
Hopefully it works now!

asp.net FileUpload control problem: access to directory is denied

Im trying to use the fileupload control. Im using Visual Web Developer Express on my desktop.
My web application is working fine except I cant use the fileUpload control. I get the following error:
ERROR: Access to the path (My_Directory) is denied
I searched and it appears to be a permissions problem. So I attempted to add the user ASPNET and give appropriate permissions to the directory, however, I was unable to add user "ASPNET". User "ASPNET" was not found.
So then I followed the following directions to add user ASPNET via Control Panel > Administration > Computer management. So now I was able to add user ASPNET to the directory and give appropriate permissions but I still got the above error.
http://p2p.wrox.com/net-web-services/5918-creating-aspnet-user.html
Any ideas on why I cant access the directory?
If you're using Vista/Windows 7/Win2003/Win2008, the user you need is the Network Service account. You can verify by seeing what user your application pool is running under.
Grant the proper permissions to that account (if indeed it's the account that your application pool is running under) and you'll be golden. Note also that with Windows 7 and Win2008, the default account could be the ApplicationPoolIdentity, which you can find out more information about at http://forums.iis.net/t/1156692.aspx. Regardless, you can simply switch the account that your application pool is running under to the Network Service account to verify that that is the issue.
Ever figure this out? If you're overwriting files check to make sure they aren't set to read-only.
I've handled these permissions plenty before and had tried everything in the book and on this site and others (I'm on Win7, IIS7.5 also). Sometimes it's the silly little things...

Resources