Wednesday, June 22, 2011

WebResource.axd and ScriptResource.axd error

If you are getting the WebResource.axd and ScriptResource.axd Java script error on your asp.net page and you are using the IIS 7.0 with IIS URL rewrite.

There is a very good chance that you have a URL rewrite rule that Enforce lowercase URLs. If that is the case then make sure that you a condition in there that will not force the WebResource.axd and ScripResource.axd to lowercase. Once you add the Rule form the IIS GUI. It will look some thing like this in the web.config file.


                <rule name="LowerCaseRule1" stopProcessing="true">
                    <match url="[A-Z]" ignoreCase="false" />
                    <action type="Redirect" url="{ToLower:{URL}}" />
                    <conditions>
                        <add input="{URL}" pattern="WebResource.axd" negate="true" />
                        <add input="{URL}" pattern="ScriptResource.axd" negate="true" />
                    </conditions>
                </rule>



The Other reason could be that you have a page that looks something like this http://www.url.com/page.aspx?id=1 and have a rule that will rewrite the URL to http://www.url.com/1 that will give you the WebResource.axd and ScriptResource.axd error. Make sure that when you rewrite the URL include the page name too. some thing like this http://www.url.com/page/1. That will fix the issue too.

1 comment:

  1. Hi, thanks to you I solved a problem that has been helping me long ago. I would like to ask you if there is a way to correct this error using a path like this: http://www.url.com/1 - tanks

    ReplyDelete