开发者

How do I add an additional route?

Here is my default route.

context.MapRoute(
"CreditReview",
"Site/{sitecode}/CreditReview/{开发者_运维问答controller}/{action}/{id}",
new { action = "Index", id = "" }
);

I'm looking to add 'status'. This is what I currently have and it isn't working. I haven't worked with routes before so I'm sorry if this is an easy question to answer.

context.MapRoute(
 "CC",
 "Site/{sitecode}/CreditReview/{controller}/{status}/{action}/{id}",
 new { action = "Index", id = "" });


In addition to Obalix's suggestions, Phil Haack's routing debugger is great for these kinds of problems.


First of all the order of the rules is important, custom rules have to be added before the default rule.

Then, if that does not work you might try to modify the rule so that it should be a bit more distinguisable.

Edit

If these are the routes you going to match

http://localhost/CreditCoachPlus.Site/Site/ABC123/CreditReview/PersonalInformation/Info
http://localhost/CreditCoachPlus.Site/Site/ABC123/CreditReview/PersonalInformation/Info/Correct

Then why not just adding the status to your default rule and set a default status?

context.MapRoute(
    "CreditReview",
    "Site/{sitecode}/CreditReview/{controller}/{action}/{id}/{status}",
    new { action = "Index", id = "", status="notCorrect" }
);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜