如何在ASP.NET MVC中配置具有3个级别的URL?
使用ASP.NET MVC,我需要如下配置我的URL: www.foo.com/company:render View company www.foo.com/company/about:render View company www.foo.com/company/about/mission:render View mission 如果“公司”是我的控制者,“关于”是我的行动,“使命”应该是什么 对于每个“文件夹”(公司、关于和任务),我必须呈现不同的视图 谁知道我该怎么做如何在ASP.NET MVC中配置具有3个级别的URL?,asp.net,asp.net-mvc,routing,url-routing,Asp.net,Asp.net Mvc,Routing,Url Routing,使用ASP.NET MVC,我需要如下配置我的URL: www.foo.com/company:render View company www.foo.com/company/about:render View company www.foo.com/company/about/mission:render View mission 如果“公司”是我的控制者,“关于”是我的行动,“使命”应该是什么 对于每个“文件夹”(公司、关于和任务),我必须呈现不同的视图 谁知道我该怎么做 谢谢 首先,设置视
谢谢 首先,设置视图:
Views\
Company\
Index.aspx
About.aspx
Mission.aspx
AnotherAction.aspx
在GlobalAsax.registerOutes(RouteCollection routes)方法中:
在控制器中:
CompanyController
{
public ViewResult Index() { return View(); }
public ViewResult About() { return View(); }
public ViewResult Mission() { return View(); }
public ViewResult AnotherAction() { return View(); }
}
CompanyController
{
public ViewResult Index() { return View(); }
public ViewResult About() { return View(); }
public ViewResult Mission() { return View(); }
public ViewResult AnotherAction() { return View(); }
}