c# - The route helper generates the wrong URL when using Route attributes -
i have controller use route attributes, see below:
[routeprefix("api/hello/product")] public class productcontroller : controller { [route("productid:int}")] public async task<actionresult> getproduct(int productid) {} } in view have this:
var url = '@url.routeurl(new { area="hello", controller = "product", action = "getproduct", productid = 123 })'; console.log(url); the output is:
/hello/product/getproduct?userid=123 when should have been:
/api/hello/product/123 is bug or url.route not work when use route attributes?
Comments
Post a Comment