My controller currently looks like:
[Jsonp filter]
public class ProductController : Controller
{
public Json GetProduct(string id)
{
Product x;
//code
return Json(x, JsonRequestBehavior.AllowGet);
}
}
I am able to get a product doing this: api/product/getproduct/5
But, I want to be able to access it like this: api/product/5
What change do I need to make to do this?
EDIT: I am actually using Jsonp because I need to call this API from a different domain and get a json object back. Would this be possible using ApiController? Otherwise is there a way to do this without switching to ApiController?