Reputation: 35780
I have action:
public ActionResult Thumbnail(string image)
{
return GetThumbnail(image);
}
I am trying to access it with the next request:
http://localhost:60955/thumbnail/imagename.png
In config I have:
<add name="Png" path="/thumbnail/*.png" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
And in routes configuration:
routes.MapRoute(
name: "Thumbnail",
url: "thumbnail/{*image}",
defaults: new { controller = "Image", action = "Thumbnail" }
);
So it works for the above image URL. But I need this to work for any subfolder and the following returns 404:
http://localhost:60955/thumbnail/screenshots/imagename.png
And when I add slash it works again:
http://localhost:60955/thumbnail/screenshots/imagename.png/
Can I make it work with no trailing slash? I feel like I need to customize the handler path in the config but cannot figure out how.
Upvotes: 0
Views: 39
Reputation: 18975
You should use query string for this case
URL change to this
http://localhost:60955/thumbnail?image=screenshots/imagename.png
Upvotes: 0