views:

55

answers:

2

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 = "" });
A: 

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" }
);
Obalix
I have the default route listed last. An example of a url that matches the default route is as follows:http://localhost/CreditCoachPlus.Site/Site/ABC123/CreditReview/PersonalInformation/InfoAn example of what I'm trying to get to work is as follows:http://localhost/CreditCoachPlus.Site/Site/ABC123/CreditReview/PersonalInformation/Info/Correct
maureliusb
A: 

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

Gabe Moothart