Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.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
C# 4.0 如何在mvc中处理路由?_C# 4.0 - Fatal编程技术网

C# 4.0 如何在mvc中处理路由?

C# 4.0 如何在mvc中处理路由?,c#-4.0,C# 4.0,如何在MVC中使用路由隐藏控制器名称、操作名称和仅显示传递的参数 例如 Url是 我只想要网址:- pageURL=返回的是动态参数值 谢谢。试试这个: private void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("default", "{controller}/{action}/{id}", n

如何在MVC中使用路由隐藏控制器名称、操作名称和仅显示传递的参数 例如 Url是

我只想要网址:-

pageURL=返回的是动态参数值

谢谢。

试试这个:

private void RegisterRoutes(RouteCollection routes) {

  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

  routes.MapRoute("default", "{controller}/{action}/{id}",
     new { action = "index", id = "" },
     // Register below the name of all the other controllers
     new { controller = @"^(account|support)$" });

  routes.MapRoute("home", "{action}",
     new { controller = "device", action = "index" });
}

来源:

控制器和操作名称是固定的。我希望url与传递的参数名相同,