From the course: Advanced ASP.NET Web API 2.2

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Version header versioning

Version header versioning

From the course: Advanced ASP.NET Web API 2.2

Start my 1-month free trial

Version header versioning

- [Instructor] Other than the methods that we have seen so far, we can use the version header method as well where instead of a query string or a route handler, we pass as a parameter in our request a custom header. So let say it's the custom header we want to pass the value X-CustomName-1. Then in this case, the first version API is going to be called and get a response from that and if we want to get a response from the second version API, then we can use the CustomName-2. Let us now go to Visual Studio and see how we can implement the version header versioning. In here, go to Solution Explorer. And then go to the Custom folder or let us rename this folder to CustomSelectors. And then open the CustomControllerSelector.cs file. In here, we're going to modify the SelectController method. Do not use the query string parameters but to use the custom headers. Now, we still need the controllers. We need the routeData,…

Contents