MVC ignoring .jpg file extension on certain route — Use Controller action?
问题 I'm trying to serve image files from a specific url system, like so: mysite/Images/Category/File_Name.extension I've set up a route like so: routes.MapRoute( "ImagesRoute", // Route name "Images/{category}/{file}.jpg", // URL with parameters new { controller = "Posts", action = "ViewImage", category = "", file = "" } // Parameter defaults ); Which is supposed to map to my controller action: public ActionResult ViewImage(string category, string file) { var dir = Server.MapPath("/Images"); var