Aamir Mulla
Aamir Mulla

Reputation: 76

Url path to an image not routing as required

I am trying to get a URL path on my (Web)API to route to a controller action.

The path is something like {Base URL}/action/integer/image.jpg. For some reason, this URL is trying to request a document - image.jpg and thus returning a 404 (Not Found). I want it to return the value of action.

I have tried the following attribute decorators, but neither seem to work.

The methods for this action correspondingly are as follows.

I have looked at a few other stack overflow solutions, but does not seems to work for this exact situation.

Upvotes: 0

Views: 201

Answers (1)

Aamir Mulla
Aamir Mulla

Reputation: 76

I tried redirecting the call using Katana. But I found I much simpler answer on one of the stack overflow questions. I can't find the link again - just make the call using the "/" suffix. This ensures what you are parsing in the last URL segment still parses to a string parameter. Then the route attribute does the rest of the magic.

{Base URL}/action/integer/image.jpg/

Upvotes: 0

Related Questions