Is there a way to intercept requests for files like .js, .html, etc in an ASP.NET WebAPI? All methods I tried could only intercept API calls. I need to change the content of js files before sending then to the client or redirect certain calls from one html file to another. I´m not using any Razor or ASP.NET MVC stuff, just plain old html and other content files.
Asked
Active
Viewed 695 times
1
-
_intercept requests for files like .js, .html, etc in an ASP.NET WebAPI_ Really ? – Cybermaxs May 16 '14 at 14:45
-
Try this: http://stackoverflow.com/questions/391130/what-is-an-httphandler-in-asp-net – Bill Gregg May 16 '14 at 14:46
-
and You serve those plain html files using WebAPI? – Grzegorz W May 16 '14 at 14:50
-
@GrzegorzW they are not served using WebAPI (through an api call), they are hosted in the same web application (ASP.NET Web API), but are served as static content. – Rafael Romão May 16 '14 at 14:56
-
@Cybermaxs Really. That is the problem I need to solve now. I know it's not the best way to do it, but it's working as desired now, as long as we don't need to intercept the pipeline. Which now we need. – Rafael Romão May 16 '14 at 14:59
-
@BillGregg I will try to make it work with a custom HTTP Handler. Thanks for the help. – Rafael Romão May 16 '14 at 15:00
-
If anyone else could help with another suggestion, I appreciate. – Rafael Romão May 16 '14 at 15:02