Barış Kısır

Senior Software Developer

 » Home
 » RSS

.NET Web API Custom Routing

25 Oct 2016 » csharp

By default, .NET Web api generates query string route for string inputs and url look like this{productName}&productCategory={productCategory}

Its really annoying and hard to understand when you have too many parameters.

How to change that?

You need to specify custom url at the top of method.


public List<Product> GetProducts(string productName, string productCategory) 

And you can even make version for api like