2012-05-31 224 views
1

使用IIS7.5和ASP.net URL重写URL,我有重写规则:文件扩展名

<rewrite url="~/store/playgame/([0-9]+)/(.*)" to="~/handlers/storeGetPlayGameContent?p1=$1&amp;p2=$2" processing="stop"/> 

这工作正常的网址:

http://127.0.0.1/store/playgame/1/c2runtime 
Requested URL: http://127.0.0.1:80/handlers/storeGetPlayGameContent?p1=1&p2=c2runtime 

但对于网址:

http://127.0.0.1/store/playgame/1/c2runtime.js 
Requested URL: http://127.0.0.1:80/store/playgame/1/c2runtime.js 

正如您所见,请求的URL现在不正确。任何文件扩展名不是.aspx的URL都将被错误地重写。

回答

0

在默认配置中,IIS将自身提供js文件,而不需要通过ASP.Net框架。这意味着您的重写器从未被咨询过。您必须将js扩展(以及任何其他想要处理的)添加到IIS管理工具中的处理程序映射中。