Access to the path ... is denied

Robert Barnes 101 Reputation points
2023-08-04T11:30:23.8333333+00:00

I have a web site written with ASP.NET(VB) that sends out a newsletter monthly, using Amazon SES. The previous month's newsletter had gone out normally, but I received a warning from Amazon that it would soon be a requirement to update security to level TLS 1.2.

I attempted to send out this month's newsletter, but I got a message

Access to the path '\www.famnet.org.nz...\NewsletterEmail.htm' is denied

I remembered the email from Amazon, and so I added into the method that sends newsletters (btnNewsletter_Click): -

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

However, although the web site was updated, I got the same error messages.

Message detail included

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.

What file is meant? Is it <path>GroupAdmin.aspx.vb, which is the object containing the btnNewsetter_Click method? Or the html page that is being sent out as the message? There is a problem with either of these: they are both on the server, and I can't see them with Windows File Explorer. I can however see them in the Server-side window of SmartFTP. I can right click and choose properties, and I see three tabs General, Permissions, and Summary. I guessed that Security has been renamed to Permissions and opened this, but it said "This server does not support changing permissions".

So how do I fix this problem? What am I doing wrong? I suspect that I'm looking in the wrong place.

Thank you, Robert Barnes

Developer technologies | ASP.NET | Other
{count} votes

3 answers

Sort by: Most helpful
  1. TP 125.8K Reputation points Volunteer Moderator
    2023-08-05T22:33:54.9466667+00:00

    Hi Robert,

    If your application is running in DefaultAppPool you would enter IIS APPPOOL\DefaultAppPool for the user object and then grant permissions as needed. Might just need Read & execute and Read to the folder/file.

    Please click Accept Answer if the above was useful.

    Thanks.

    -TP


  2. Robert Barnes 101 Reputation points
    2023-08-06T22:02:42.6433333+00:00

    Unfortunately that didn't help. I was able to add DefaultAppPool to the user list, but I still continue to get the message about "Access to the path ... denied".


  3. Gary Carlos 0 Reputation points
    2025-03-21T14:52:41.5533333+00:00

    None of these solutions worked on my cooperate network, but I did find a solution.

    Add the IUSR user for full permissions as mentioned, then add the IUSR user to the "IIS_IUSRS" group. My corporate network security is very tight and I cannot make new user accounts, but moving IUSR to this group made reading/writing an XML file to the web app folder work. No other solution worked for me.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.