ImageOptimizations\App_Sprites\blank.gif Access is denied

433 Views Asked by At

To optimize the images and automatically generate CSSprites use a microsoft package called Sprite Optimization and Image Preview 4

Error

Locally everything works perfectly, but to publish my site the following error occurs:

Access to the path 'D:\Hosting\8399780\html\dev\App_Sprites\blank.gif' 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 'D:\Hosting\8399780\html\dev\App_Sprites\blank.gif' 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 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.

Attempt

In an attempt to resolve the problem within 'App_Sprites' folder, added the following web.config:

<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>

  <system.webServer>
    <security>
      <authorization>
        <add accessType="Allow" users="*" />
      </authorization>
    </security>
  </system.webServer>

</configuration>

'blank.gif' image is not used anywhere in my application! Inside the App_Sprites folder there are a only one subfolder called hire;

1

There are 1 best solutions below

0
On BEST ANSWER

I believe that this framework is trying to write a blank.gif file to that directory. You need to give the account under which the IIS app pool runs write access to that folder in windows.