To build a link that matches this route:
routes.MapRoute(
"CatalogFilter",
"{url}Catalog.aspx/{fltr}",
new { controller = "Catalog", action = "Index", page = 1 }
);
You need to specify all of the route values that exist in the route. You have 5 values:
- controller
- action
- page
- url
- fltr
So you need to supply all 5 values to match the route from an ActionLink
. If you want to generate the URL /MotorOilCatalog.aspx/156
, you have to make the ActionLink
like this:
@Html.ActionLink("my link", "Index", "Catalog", new { page = 1, fltr = 156, url = "MotorOil" }, null)
Do note that the way you have it configured, the only way to override a page number from the URL is to add it to the query string.
/MotorOilCatalog.aspx/156?page=2
Since your question is unclear, I am assuming of course that this is an MVC application, and that you have a Catalog
controller in your application with an Index
method.
public class CatalogController : Controller
public ActionResult Index(string url, int fltr, int page)
{
// Implementation
return View();
}
}
If this is in fact an ASP.NET application, you should be using MapPageRoute instead of MapRoute
to build your routes to map them to physical pages instead of controllers.
Reference: https://msdn.microsoft.com/en-us/library/cc668177.aspx