Switching to {controller}/{id}/{action} breaks RedirectToAction

后端 未结 6 1947
后悔当初
后悔当初 2021-01-04 23:55

I am trying to use proper REST urls with MVC. To do that I switched default Routing from:

{controller}/{action}/{id}
6条回答
  •  我在风中等你
    2021-01-05 00:46

    Try passing in new (empty) RouteValueDictionary in your controller

    return RedirectToAction("Search", new System.Web.Routing.RouteValueDictionary{});
    

    And here:

    Html.ActionLink("Approve", "Approve", new { Id = 23})
    

    I don't even know how can it pick up the Customer controller, since you are not specifying it anywhere. Try providing both controller and action to ActionLink helper.

提交回复
热议问题