asp mvc 路由

public override void RegisterArea(AreaRegistrationContext context)
        {
            
           context.MapRoute(
                 "Workflow_FormContainer",
                 "Workflow/form/{instanceNodeID}/{instanceFlowId}",
                 new { 
                    controller = "FormContainer", 
                    action = "Index",
                    instanceFlowId = UrlParameter.Optional}
                     );
                 
            
            context.MapRoute(
             "Workflow_default",
             "Workflow/{controller}/{action}/{id}",
             new {action = "Index", id = UrlParameter.Optional }
            );
            
            
                    
        }

自定义了一个路由,似乎一定要加默认的路由之前,否则不生效.

http://localhost:20000/Workflow/form/1588 

context.MapRoute(
                 "Workflow_FormContainer",
                 "Workflow/form/post/{instanceNodeID}/{instanceFlowId}",
                 new { 
                    controller = "FormContainer", 
                    action = "Index",
                    instanceFlowId = UrlParameter.Optional}
                     );
                 
            

不过把第一个路由改成 加一个 post ,放在默认的后面倒是可以

http://localhost:20000/Workflow/form/post/1588 

posted on 2013-12-24 17:38  聪明的大熊  阅读(163)  评论(0编辑  收藏  举报