When you build a website in ASP.NET on  IIS 7.0 parts of your website may not work & display the error shown below.

In this instance the website is sending an order confirmation email.

The reason you get this error is that the default configuration of IIS 7.0 uses the user MACHINE NAME\Network Service to execute some types of anonymous access and not IUSR_MACHINENAME.

You have two options one is to setup impersonation by editing the web.config   file if you are just the system admin & are uncomfortable messing around with the web.config file then the simpler option is to give the  user MACHINE NAME\Network Service modify rights the folder in question which in this case  is C:\inetpub\mailroot\Pickup\



Server Error in '/' Application.

Access to the path 'C:\inetpub\mailroot\Pickup\b47ff1f1-dc5a-4fed-a8c2-a80d7c26d901.eml' is denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\inetpub\mailroot\Pickup\b47ff1f1-dc5a-4fed-a8c2-a80d7c26d901.eml' 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) 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 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.

Source Error:

If it helped would appreciate a rating star.

Microsoft Certified Partner


Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618