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?
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>
Now when a request is made to /Resource/Details/ClearExternalPlaySeekMute.swf
it will be served by /ClearExternalPlaySeekMute.swf
.
This should work for you, but I think this would be better through IIS.
routes.IgnoreRoute("{file}.swf");
I remember a SO post that was really good. If I find it, I'll be sure to reference.
Basically the same question... Using ASP.NET routing to serve static files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With