In ASP.Net MVC we have @Url.Action
for actions. Is there something similar like @Url.Api
which would route to /api/controller?
| |||
feedback
|
The ApiController has a property called Url which is of type System.Web.Http.Routing.UrlHelper which allows you to construct urls for api controllers. Example:
This UrlHelper doesn't exist neither in your views nor in the standard controllers. UPDATE: And in order to do routing outside of an ApiController you could do the following:
or inside a view:
Notice the Obviously this assumes that your Api route is called
| |||||||||||
feedback
|
What if do not know nothing about HttpRoute Name? EDIT: Answered by myself
| ||||
feedback
|