Keep the IIS 7 URL Rewrite Module from matching / ScriptResource.axd

I have a website and I set the Rewrite URL using the web platform installer. I want to allow a user-friendly URL, such as www.foo.com/123456, to www.foo.com/page.aspx?blah=123456. Using a friendly URL does this, except that the rule created also matches all / scriptresource.axd?blahblah created by ASP.NET, which of course violates most of the functions. My initial attempts to exclude script resource files failed.

Tool created regular expression ^([^/]+)/?$

+4
source share
3 answers

This can be prevented by adding the following to your rule section:

 <add input="{URL}" negate="true" pattern="\.axd$" /> 
+6
source

If everything that interests you ends with .com, .com \? \ D {6,7} $ should correspond to the period followed by com, followed by a question mark, followed by either 6 or 7 digits if they occur in end of line

0
source

I also had this problem. I found that this was my URL rewriting rule blocking script resources. I was able to work around the problem by adding a precondition to my outgoing rule that excluded files containing axd

0
source

Source: https://habr.com/ru/post/1300792/


All Articles