0

{controller}/{action} + {controller}/{id}:

How can I make the routing pattern distinguish between the 2?

The first one should link to Home/Dealers (Home-controller, Dealer-action)

The second should link to Store/Audio (Store-controller, Audio = parameter)

2 Answers 2

1

Take a look at routeconstraints. http://msdn.microsoft.com/en-us/library/cc668201.aspx#adding_constraints_to_routes

Sign up to request clarification or add additional context in comments.

Comments

0

Create custome route

Global.asax

routes.MapRoute(
    "Store",
    "Store/{parameter}/",
    new { controller = "Store", action = "Index", parameter = UrlParameter.Optional }
);

StoreController.cs

public class StoreController : Controller
{
    public ActionResult Index(string parameter)
    {
        return View();
    }
}

2 Comments

thanks, i have it working now with store/{parameter} and {controller}/{action}. i had the order of the routes initially wrong.
Exactly. Make sure the default route is the last route! As mentioned here: stackoverflow.com/a/973212/277649

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.