Global.asax, route determination

I have a question about global.asax that I really don't understand. My scenario is that I defined this route:

routes.MapRoute(
                "Suspensions",
                "Suspension/{action}/{id}/{prev}",
                new { controller = "Suspension", action = "Index", id = "", prev = "" }
                );

The thing is, when I call it this:

<%= Html.ActionLink("Edit", "EditTemporal", new { id = item.TCtsRecID,
                                                  prev = previousPage})%>

I get the following generated route:

http://localhost:1537/Suspension/EditTemporal/3941?prev=1

I really expected it to be http://localhost:1537/Suspension/EditTemporal/3941/1, because I use the split method to get the passed parameters and show or hide parts of the page depending on the last parameter. Could you tell me what I am doing wrong because I don’t understand how I want? I know that there are several ways around this, but I would like this specific solution, because that is what I believe should do.

Thanks everyone! Victor

+3
1

, , . , Suspensions () ?

+1

Source: https://habr.com/ru/post/1744919/


All Articles