Click here to Skip to main content
15,909,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am setting multiple routing in web api, I write code for that in webapi config when I pass the same number of parameter in url, then first one written controller route call second is not called. My code is below in webapiconfig file.
C#
config.Routes.MapHttpRoute(
  name: "DefaultApi",
  routeTemplate: "api/{controller}/{id}",
  defaults: new { id = RouteParameter.Optional }
);

1)
C#
config.Routes.MapHttpRoute(name: "CustomerParams", routeTemplate: "api/{controller}/{IP}/{Port}/{CompanyName}/{UserName}/{Password}/{CustomerName}/{city}/{Phone1}");

2)
C#
config.Routes.MapHttpRoute(name: "InventoryParams", routeTemplate: "api/{Controller}/{IP}/{Port}/{CompanyName}/{UserName}/{Password}/{Item}/{Description}/{Price}");

if i changed the 2 routing on first place then it call, then other is not called
please help.
Posted
Updated 23-Dec-15 2:33am
v2
Comments
Kornfeld Eliyahu Peter 23-Dec-15 9:04am    
1. Just to make it sure...You have 3 mappings?
2. Show us the action signatures...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900