【发布时间】:2016-04-06 07:00:48
【问题描述】:
网址:localhost:4835/登录
public class LoginController : Controller
{
public ActionResult Index()
{ 'enter code here' }
}
我想在不提及动作名称的情况下调用 index。
【问题讨论】:
-
显示路线定义
标签: asp.net-mvc routedata
网址:localhost:4835/登录
public class LoginController : Controller
{
public ActionResult Index()
{ 'enter code here' }
}
我想在不提及动作名称的情况下调用 index。
【问题讨论】:
标签: asp.net-mvc routedata
您的RouteConfig 文件中应该有这样的内容:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Your Default Controller Name", action = "Default Action name(usually Index)", id = UrlParameter.Optional }
);
您可以拥有自己的映射,这里只是提供了一个示例。
【讨论】: