URL Rewrites create compatibility issue with AjaxT

2019-09-02 18:44发布

问题:

I'm using the latest AjaxControlToolKit v15.1.3 and using the ...

ajaxtoolkit:calendarextender

for popping up the calender tool on click.
everything works fine enough till there. now, when i add the URL rewrite code on the web.config file, the pop up on click no longer happens. any specific edit on the code i need to update for both to work.

Here is the URL rewrite code:

<rewrite>
  <rules>
    <rule name="RewriteASPX">
      <match url="(.*)" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="{R:1}.aspx" />
    </rule>
  </rules>
</rewrite>

回答1:

AjaxControlToolkit is known to not work with URL rewrites. This is because the AjaxControlToolkit generates two script files with .axd extensions at runtime: WebResource.axd and ScriptResource.axd. Several references to those two .axd files get inserted in your client side HTML with huge strings of alphanumeric and non-alphanumeric characters as URL parameters. Those references will fail when URL rewrites are used. In my case, and as outlined in this post, the specific failure is a 403 (Forbidden) error. The solution provided in that post worked for me, which was to remove all URL rewrites. Hopefully that's an option for you too.