Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 ASP.NET MVC3复杂路由问题_Asp.net Mvc 3_Routing_Routes - Fatal编程技术网

Asp.net mvc 3 ASP.NET MVC3复杂路由问题

Asp.net mvc 3 ASP.NET MVC3复杂路由问题,asp.net-mvc-3,routing,routes,Asp.net Mvc 3,Routing,Routes,我设置了以下默认路线,效果良好: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter def

我设置了以下默认路线,效果良好:

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
下面是一个成功的路线示例:“/PositionDetail/Candidates/2”

这一切都很好,但我的问题是,我想建立一条更深入的路线。i、 e.“/PositionDetail/Candidates/2/GetMoreCandidates”“/PositionDetail/Candidates/2/Resume/3”,其中简历将是我想要执行的另一个操作,3将是ID。注意:每个路由将加载一个新页面,而不是一些局部视图


我如何设置这样的东西,“位置细节”控制器是什么样子的

例如,对于第二个任务,它可能如下所示:

public ActionResult Resume(int CandidateID, int ResumeID)
{

return View();
}
在您的路线中:

routes.MapRoute(
                "Resume", // Route name
                "{controller}/Candidates/{CandidateID}/{action}/{ResumeID}", // URL with parameters
                new { controller = "PositionDetail", action = "Resume", CandidateID = UrlParameter.Optional, ResumeID= UrlParameter.Optional } 
            );
对于第一个任务-相同的逻辑