Asp.net MVC3导航到控制器
很抱歉这个愚蠢的问题,但是我怎样才能实现下面的事情呢 我有一个名为ServerMonitor的控制器,它只有一个操作Asp.net MVC3导航到控制器,asp.net,asp.net-mvc-3,asp.net-mvc-routing,Asp.net,Asp.net Mvc 3,Asp.net Mvc Routing,很抱歉这个愚蠢的问题,但是我怎样才能实现下面的事情呢 我有一个名为ServerMonitor的控制器,它只有一个操作 public ActionResult Index() { return Content(WebUtility.ServerID); } 如何执行以下操作 而不是http://mydom.com/ServerMonitor/Index您需要将路由URL中的{action}参数默认设置为“index” ASP.NETMVC
public ActionResult Index()
{
return Content(WebUtility.ServerID);
}
如何执行以下操作
而不是http://mydom.com/ServerMonitor/Index您需要将路由URL中的
{action}
参数默认设置为“index”
ASP.NETMVC模板中定义的标准路由已经执行此操作
routes.MapRoute
(
"RouteName",
{controller}",
new{action = "index", id = "UrlParameter.optional"
);
我想这基本上就是你需要的