Tomas Walek Tomas Walek - 4 months ago 27
ASP.NET (C#) Question

Defining a WebAPI route without the /api/{controller} prefix

I want to process requests in format without the /api/{Controller} prefix (e.g. by a WebAPI controller method. Is it even possible or do I need do switch to MVC controller? I Defined the following route:

name: "Check",
routeTemplate: "download",
defaults: new { controller = "Download", action = "CheckAccess" });

but unfortunately it is not working, the controller doesn't even gets created (I have traces in the constructor)


Try attribute routing ( only available in web api 2)