I would like .png images following the relative path of "m/{id}.png" to be routed through a specific controller which will dynamically generate a redirect based on the id (does a lookup in a particular api to get redirect link)
Now I have been doing a lot of research and feel I am getting close. For starters, I have faithfully tried every single idea from this thread and not one will work. The reason they do not work is because IIS looks at it before it even gets to the handlers and tries to fetch it, and of course fails giving 404 errors.
So next, I come across the "sledge hammer" of having
<modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthenticationModule" />
</modules>
(With the remove FormsAuthentication being there by default)
And it kind of works, I defined the following in my route config and it goes to my custom handler perfectly if the file matches the path:
routes.MapRoute(
name: "MosaicImageDefault",
url: "m/{mosaicId}.png",
defaults: new { controller = "Mosaics", action = "RetrieveImageDefault", mosaicId = ""}
);
ONE PROBLEM:
All static files didn't show up, no css, js, images, nothing. I get error 400 (bad request) for png images and error 404 for all files. Somehow it doesn't know how to handle regular static files anymore.
This seems really simple, yet I have been stuck on it for 8+ hours. I have tried setting up a custom HTTP handler but to no look as well. If you could recommend what my Web.Config, RouteConfig.cs, and any other handlers/classes I might need, it would be most helpful. Like I said, I think I am close, just missing a step or two.
Thank you very much in advance.