On the client side, I can only request a URL address from the Web API, but I need to provide many different logic.
So, my Web API URL is
http://exampleDomain.com/ControllerDemo/HubActions?ActionName=(This url in client can't change)
When request url is
http://exampleDomain.com/ControllerDemo/HubActions?ActionName=ActionA
it should be routed to /ControllerDemo/ActionA
When request url is
http://exampleDomain.com/ControllerDemo/HubActions?ActionName=ActionB
it should be routed to /ControllerDemo/ActionB
In your
Program.cs
(ImplicitUsings
):Just add custom middleware before
app.UseRouting()
, like this:See MSDN documentation: