Asp.net 重写网址的问题,用其他类型都行,但重写txt文件的地址怎么就不行呢.
dx136 2009-03-27 07:16:42 我网站根目录里绑定了多个域名,希望通过不同的域名进入的时候输出不同的robots.txt,
所以就必须重写robots.txt网址了,
我引用的是URLRewriter.dll,
web.config里都写对了.
在相应的地方分别添加三处内容
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
<RewriterRule>
<LookFor>~/robots\.txt</LookFor>
<SendTo>~/robots.aspx</SendTo>
<!--重定向到robots.aspx文件,这样才能通过脚本返回不同的内容-->
</RewriterRule>
<httpHandlers>
<add verb="*" path="*.*" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
</httpHandlers>
然后修改 IIS配置,将.txt文件映射到 aspnet_isapi.dll 上,跟.aspx文件一样的效果.
以上配置应该是没有问题的,因为我换其他的扩展名都行,但就是换.txt文件不起作用.
哪位如果能解决这个问题,或达到要求的效果均给分.