开发者

Global.asax, definition of routes

开发者 https://www.devze.com 2022-12-30 02:05 出处:网络
I have a question about global.asax that I don\'t really understand. My scenario is that I have this route defined :

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

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

The thing is that when I call it like:

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

I get the following route generated:

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

What I really expected it to do would be http://localhost:1537/Suspension/EditTemporal/3941/1, because I'm using the split method to get the options passed and show or hide parts of the page depending on the last parameter. Could you tell me what am I doing wrong for not getting it as I want it? I know there are some ways round this, but I would like this specific solution, as it is what I开发者_C百科'm suppossed to do.

Thank you all! VIctor


It sounds like it could be possibly hitting the Default route. Have you checked that your Suspensions route is defined before (above) the default route?

0

精彩评论

暂无评论...
验证码 换一张
取 消