Here is an example of what I am trying do.
Provide an MVC Route from test.js to a controller action e.g.
> http://localhost/MVCScripts/test.js?id=123
to the controller
> http://localhost/Home/RenderJavascript?id=123
The reason behind this is to produce a dynamic js file rendered from the server based on the id. The JS file will be linked to by being embedded into other websites.
I have tried setting the web.config to exclude the script folder in question:
<handlers>
<add name="scripts" path="/MVCScripts/*" verb="GET" type="System.Web.Handlers.TransferRequestHandler" />
</handlers>
and then added a route such as:
routes.MapRoute(
name: "EmbedCode",
url: "MVCScripts/test.js",
defaults: new { controller = "Home", action = "RenderJavascript", id = UrlParameter.Optional }
);
When invoking
> http://localhost/MVCScripts/test.js?id=123
I just get
The controller for path '/MVCScripts/test.js' was not found or does not implement IController.
Note that my aim here is to use MVC Routing. Thanks