所以我有一个 webforms 和一个 mvc 应用程序组合,并试图让事情正确路由。我的默认路由按预期工作,但是当我在我的一个视图中单击操作链接时,它没有路由到正确的页面。
这是我的路由代码。
void RegisterRoutes(RouteCollection routes) {
           routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
           routes.MapPageRoute("",
               "", "~/Default.aspx", true);
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Chips", action = "Index", id = UrlParameter.Optional }
            );
        }
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
           AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
这是我要单击的操作链接:@Html.ActionLink("Properties Editor", "Index", "Property")
这是我的预期结果:urlgoeshere.com/Property/Index
这是我的实际结果:urlgoeshere.com/?action=Index&controller=Property
我不确定要改变什么来纠正这种情况?有任何想法吗?