开发者

Keep IIS 7 URL Rewrite module from matching /ScriptResource.axd

I have a website and I have installed URL Rewrite using Web Platform Installer. I wish to allow a user friendly URL like www.foo.com/123456 to 开发者_开发知识库go to www.foo.com/page.aspx?blah=123456. Using the User-friendly URL template accomplishes this except that the created rule also matches all of the /scriptresource.axd?blahblah created by ASP.NET which of course breaks most functionality. My initial attempts to exclude the script resource files have failed.

The regex generated by the tool is ^([^/]+)/?$


You can prevent this by adding the following to the section of your rule:

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


If all of the things you're interested in matching end with .com, .com\?\d{6,7}$ should match a period followed by com followed by a question mark followed by either 6 or 7 digits, provided they occur at the end of the string


I've had this problem as well. I found that is was my outbound url rewrite rule blocking the script resources. I managed to get round the problem by adding a precondition to my outbound rule that excluded files containing axd

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜