I am trying to create Odata method that satisfy url like
domain:port/products/100/RedirectUrl()
[ODataRoute("{id}/RedirectUrl()")]
public IHttpActionResult RedirectUrl(int id)
{
return Redirect("myUrl" + id);
}
but i got exception like
The path template '{id}/RedirectUrl()' on the action 'RedirectUrl' in controller 'Products' is not a valid OData path template
My Webapi config contains
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<Product>("Products");
builder.EntityType<Product>().Function("RedirectUrl").Returns<IHttpActionResult>();
Any way to achieve this?