rolfg
asked on
How to fix WebResource.axd error 403 because of webconfig rewrite rules IIS7 2008r2
I have a Windows 2008R2 server IIS 7 running WordPress. It works fine.
I'm running asp.net pages on this server just fine until I got an app that uses Webresource.axd.
First suggested things to look at were the handlers:
I have:
<add name="AssemblyResourceLoad er-Integra ted" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers. AssemblyRe sourceLoad er" preCondition="integratedMo de" />
and
<add name="AssemblyResourceLoad er-Integra ted-4.0" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers. AssemblyRe sourceLoad er" preCondition="integratedMo de,runtime Versionv4. 0" />
So I think I'm good here (although I'm running 4.5.1 but I believe that runs under 4.0 integrated).
Next issue probably is webconfig:
stackoverflow.com/question s/12153195 /403-forbi dden-all-a xd-files-a ragh suggest to use:
<rule name="Ignore SubFolder" stopProcessing="true">
<match url="subFolderName" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
but when I insert that as the first rule I get an error 500 on every page of the website.
Any suggestions?
I'm absolutely inexperienced with webconfig rewrites.
Thanks a million,
Rolf
I'm running asp.net pages on this server just fine until I got an app that uses Webresource.axd.
First suggested things to look at were the handlers:
I have:
<add name="AssemblyResourceLoad
and
<add name="AssemblyResourceLoad
So I think I'm good here (although I'm running 4.5.1 but I believe that runs under 4.0 integrated).
Next issue probably is webconfig:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rule name="WordPress Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="WordPress Rule 2" stopProcessing="true">
<match url="^files/(.+)" ignoreCase="false" />
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
</rule>
<rule name="WordPress Rule 3" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="WordPress Rule 4" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<remove value="Default.asp" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
stackoverflow.com/question
<rule name="Ignore SubFolder" stopProcessing="true">
<match url="subFolderName" />
<conditions logicalGrouping="MatchAll"
<action type="None" />
</rule>
but when I insert that as the first rule I get an error 500 on every page of the website.
Any suggestions?
I'm absolutely inexperienced with webconfig rewrites.
Thanks a million,
Rolf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi rolfg,
Hmmm this demands an explanation. I will try to keep it short but provide you with all the details (as much as I can).
</clear> basically directs asp.net runtime to forget whatever rules are being inherited from the parent for a given setting. This applies to all the settings which can be inherited.
Here is MSDN document for your reference: http://msdn.microsoft.com/ en-us/libr ary/aa9033 45(v=vs.71 ).aspx
It is a known gotcha and you can refer to Scottgu's blog for a similar problem and explanation on those lines:
http://weblogs.asp.net/sco ttgu/archi ve/2006/11 /20/common -gotcha-do n-t-forget -to-clear- when-addin g-provider s.aspx
And about WordPress whether WordPress was mentioned or not clearly your site was inheriting some rules from its parent and that was giving you all these troubles. I don't have much insight in your environment and honestly I love asp.net but my interaction to asp.net has been reduced to almost nothing hence I will not be able to help you further troubleshoot it but yes it will be interesting to look around in parent sites to see if you find something there.
Regards,
Chinmay.
Hmmm this demands an explanation. I will try to keep it short but provide you with all the details (as much as I can).
</clear> basically directs asp.net runtime to forget whatever rules are being inherited from the parent for a given setting. This applies to all the settings which can be inherited.
Here is MSDN document for your reference: http://msdn.microsoft.com/
It is a known gotcha and you can refer to Scottgu's blog for a similar problem and explanation on those lines:
http://weblogs.asp.net/sco
And about WordPress whether WordPress was mentioned or not clearly your site was inheriting some rules from its parent and that was giving you all these troubles. I don't have much insight in your environment and honestly I love asp.net but my interaction to asp.net has been reduced to almost nothing hence I will not be able to help you further troubleshoot it but yes it will be interesting to look around in parent sites to see if you find something there.
Regards,
Chinmay.
ASKER
Ok, it fixed my problem and broke something else.
Now everything like mydomain.com/wordpress-pag e gets a 404 error
So I had to take it out again.
Moved it to the top, saw no adverse effects, but did not fix my original error then added:
<rules>
<clear />
<rule name="Ignore SubFolder" stopProcessing="true">
<match url="^signNDA" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="None" />
</rule>
... wordpress rules ...
signNDA being the folder that uses WebResource.axd and that fixed it.
Rolf
Now everything like mydomain.com/wordpress-pag
So I had to take it out again.
Moved it to the top, saw no adverse effects, but did not fix my original error then added:
<rules>
<clear />
<rule name="Ignore SubFolder" stopProcessing="true">
<match url="^signNDA" />
<conditions logicalGrouping="MatchAll"
<action type="None" />
</rule>
... wordpress rules ...
signNDA being the folder that uses WebResource.axd and that fixed it.
Rolf
ASKER
But I tried it this morning before production time and lo and behold it solved the problem without even adding the extra rules suggested in the first answer.
Awesome!
So what is <clear /> supposed to do? I have it seen in other samples at the beginning of the rules as well. Something I should do as well?
Thanks!
Rolf