To achieve this, interchange the ID and action string in the routeTemplate property of Register(HttpConfiguration config) in WebApiConfig.cs.
Refer to the following code snippet.
Then, pass the ID from the view page to the web API controller. Refer to the following code snippet.
Note: String value can also be passed to the Web API controller.
In the Web API controller, add an overload in the web action methods as follows.
Note: If you are passing the value as a string, the datatype of ID must be a string.
Executing the previously given sample will provide the output as follows.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
or the page will be automatically redirected to sign-in page in 10 seconds.