Flash movie not made available by ASP.NET MVC
I'm working on an ASP.NET MVC app that uses a Flash movie as a banner. I'm trying to load it, however for some reason the url gets treated as an Action and the user is redirected to the login page.
The funny thing is, if I put a file in the same directory with a different extension (.txt, for example) and try to load that, it doesn't get treated as an Action.
If I point my browser to this url:
http://localhost/AppImWorkingOn/Content/Banner/b开发者_StackOverflowanner.swf
That gets me a redirection to /Account/LogOn?ReturnUrl=..., the standard ASP.NET MVC login route.
If I point my browser to this url:
http://localhost/AppImWorkingOn/Content/Banner/banner.txt
That gets me the file. Both urls point to files existing on the server in the same directory. It's as if something is blocking the .swf filetype.
I'm using IIS on Windows 7, and checked MIME and such, but can't find the problem. How does ASP.NET MVC decide whether something's a file or a controller action?
Make MVC ignore the route for the ".swf" extension.
http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx
The issue was file permissions. This was a file that came from a zip sent to me via e-mail. I dragged the folder out of the zip and moved it into place, which was probably the worst I could do. The files were individually blocked and encrypted (they turned up green) so the UrlRouteModule wouldn't treat them as files that existed and would instead insist that they're Action methods.
I should have "unblocked" the zip file before starting to copy the assets in it.
精彩评论