Base solution for your next web application
Open Closed

Url parameters using dynamic api method #759


User avatar
0
owen84 created

Can i specify the routes using the dynamic api method? I want to use url parameters.

To better explain i have the following:

foo/create foo/edit foo/action1 foo/action2 foo/action3

I would like to have it:

foo/create foo/edit foo/{id}/action1 foo/{id}/action2 foo/{id}/action3

Instead of passing the id through as an input object parameter


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    You may try attribute routing (remember to enable it before: <a class="postlink" href="http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2">http://www.asp.net/web-api/overview/web ... -web-api-2</a>). You should add route attributes to methods in the application service interface.