So I have a webforms and an mvc application combined and am trying to get things routed correctly. I have the default routing working as expected, but when I click on an actionl
I ended up having to add a routing constraint. Here's what I ended up doing.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapPageRoute("",
"", "~/Default.aspx", true, null, new RouteValueDictionary { { "outgoing", new PageConstraint() } });
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Chips", action = "Index", id = UrlParameter.Optional }
);
And the page constraint.
public class PageConstraint : IRouteConstraint
{
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
{
if (routeDirection == RouteDirection.IncomingRequest)
return true;
return false;
}
}