Hello, I have the following area route registration method:
/// <summary>
/// Registers the area.
/// </summary>
/// <param name="context">The context.</param>
public override void RegisterArea(AreaRegistrationContext context)
{
// terminal customer url
context.MapRoute("TerminalCustomer", "Terminal/Customer/{action}/{id}", new { controller = MVCt4.TerminalArea.Customer.Name, action = MVCt4.TerminalArea.Customer.ActionNames.Index, id = string.Empty });
// terminal inbound pattern url
context.MapRoute("TerminalInboundPattern","Terminal/InboundPattern/{action}/{id}",new { controller = MVCt4.TerminalArea.InboundPattern.Name, action = MVCt4.TerminalArea.InboundPattern.ActionNames.Index, id = string.Empty });
// terminal outbound pattern url
context.MapRoute("TerminalOutboundPattern","Terminal/OutboundPattern/{action}/{id}",new { controller = MVCt4.TerminalArea.OutboundPattern.Name, action = MVCt4.TerminalArea.OutboundPattern.ActionNames.Index, id = string.Empty });
// terminal inbound shipment url
context.MapRoute("TerminalInboundShipment", "Terminal/InboundShipment/{action}/{id}", new { controller = MVCt4.TerminalArea.InboundShipment, action = MVCt4.TerminalArea.InboundShipment.ActionNames.Index, id = string.Empty });
// terminal outbound shipment url
context.MapRoute("TerminalOutboundShipment", "Terminal/OutboundShipment/{action}/{id}", new { controller = MVCt4.TerminalArea.OutboundShipment, action = MVCt4.TerminalArea.OutboundShipment.ActionNames.Index, id = string.Empty });
}
It works fine as is, but when I change to the typesafe and no magic way of like this:
context.MapRoute("TerminalOutboundShipment", "Terminal/OutboundShipment/{action}/{id}", MVCt4.TerminalArea.OutboundPattern.Index(), new {id = String.Empty});
I get a runtime error? I have this code in the global.asax file and it works fine:
static public void RegisterRoutes(RouteCollection routes)
{
// do not allow any body access our our resources
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("favicon.ico");
// home url ok
routes.MapRoute("Default", "Home/{action}/{id}", MVCt4.Home.Index(), new {id = String.Empty});
}
In the areas it does not work put the main global asa it works fine?