Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

403 forbidden all *.axd files - aragh

frustrating .axd resources forbidden

I can run the application on my development machine. When I go to publish it to my production machine, it does not work. Says that the .axd files are forbidden.

Any ideas? I'm getting so frustrated!

Edit:

As a test, I've changed to be "storage=file;". When I send a request to the server for generating a chart, the chart actually appears in my folder - it just doesn't get sent back to the browser in the request.

ARAGH! What is going on!?!?!

Added web.config

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="ChartImageHandler" value="storage=memory;"/>
  </appSettings>
  <connectionStrings>
    <add name="VS265178_1ConnectionString" connectionString="Data Source="HIDDEN"/>
  </connectionStrings>

  <system.web>

    <httpHandlers>
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        validate="false" />
    </httpHandlers>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>

    <authentication mode="Forms">
      <forms loginUrl="Login.aspx" name=".CFCASPXFORMSAUTH" defaultUrl="Default.aspx"/>
    </authentication>
    <authorization>
      <deny users="?"/>
    </authorization>
    <machineKey validationKey="HIDDEN" decryptionKey="HIDDEN" validation="SHA1"/>
    <!-- Custom Membership Provider Configuration -->
    <membership defaultProvider="CFMembershipProvider" userIsOnlineTimeWindow="15">
      <providers>
        <clear/>
        <add name="CFMembershipProvider" passwordFormat="Clear" type="HIDDEN" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" writeExceptionsToEventLog="false"/>
      </providers>
    </membership>

    <profile defaultProvider="CFProfileProvider">
      <providers>
        <add name="CFProfileProvider" type="HIDDEN"/>
      </providers>
    </profile>
    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </controls>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <remove name="ChartImageHandler"/>
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </handlers>
  </system.webServer>
</configuration>
like image 241
itwb Avatar asked Dec 06 '22 12:12

itwb


2 Answers

URL rewrites on the web site are inherited by all child applications. One solution is to add this to your application web.config:

<system.webServer>
  <rewrite>
    <rules>
      <!-- remove parent rewrite rules -->
      <clear/>
    </rules>
  </rewrite>        
</system.webServer>
like image 178
Sire Avatar answered Dec 09 '22 02:12

Sire


So the answer.

URL Rewrites are a killer.

I had a wordpress installation on a web application which was above the application I was having problems with. The wordpress installation was actually doing rewrites and because it wasn't a file or directory (wordpress default) it was rewriting any request that didn't have a physical corresponding file or folder.

If you're getting random errors, and you're using sub applications - look at the REWRITES!

like image 23
itwb Avatar answered Dec 09 '22 01:12

itwb