本文介绍了MVC路由静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我与正在寻找在控制器/操作路由静态路由的传统swf文件的工作。例如,它试图下载的文件
I am working with a legacy swf file that is looking in the controller/action routing for a static route. For example, it is trying to download the file
http://localhost:59801/Resource/Details/ClearExternalPlaySeekMute.swf
在该文件存在于根目录:
When the file exists in the root directory:
http://localhost:59801/ClearExternalPlaySeekMute.swf
我可以使用图路线
来将该网址映射到根目录?
Can I use MapRoute
to map this URL to the root directory?
推荐答案
您可以使用在IIS模块。一旦你安装它只是添加以下重写规则:
You could use the url rewrite
module in IIS. Once you install it simply add the following rewrite rule:
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite Static Flash file" stopProcessing="true">
<match url="^Resource/Details/ClearExternalPlaySeekMute.swf$" />
<action type="Rewrite" url="ClearExternalPlaySeekMute.swf" />
</rule>
</rules>
</rewrite>
</system.webServer>
现在,当一个请求以 /Resource/Details/ClearExternalPlaySeekMute.swf
它将被 /ClearExternalPlaySeekMute.swf $ C送达$ C>。
Now when a request is made to /Resource/Details/ClearExternalPlaySeekMute.swf
it will be served by /ClearExternalPlaySeekMute.swf
.
这篇关于MVC路由静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!