允许用户键入URL
http://example.com/controller
获取操作“索引”
如何禁用
http://example.com/controller/index
以便链接重定向到http://example.com/controller
答案 0 :(得分:0)
Maybe don't have configuration on the route , I have to do with the method below.
public ActionResult Index(){
string item = Url.Content(Request.Url.PathAndQuery);
if (item.Equals("/controller/index", StringComparison.InvariantCultureIgnoreCase))
{
return Redirect("/controller");
}else
{
return View();
}
}