How to add an additional route?

Here is my default route.

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

I want to add status. This is what I have now, and it does not work. I have not worked with routes before, so I'm sorry if this is a simple question to answer.

context.MapRoute(
 "CC",
 "Site/{sitecode}/CreditReview/{controller}/{status}/{action}/{id}",
 new { action = "Index", id = "" });
+3
source share
2 answers

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

0
source

First of all, the order of the rules is important; custom rules must be added before by default.

, , , .

Edit

,

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

?

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

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


All Articles