如何在ASP.NET MVC 1中进行操作,以获取子文件夹。例如,在 Controller 上采用以下文件夹结构:
/Controller
/Blog
ViewsController.cs
ArticlesController.cs
/Customers
SalesController.cs
ProductsController.cs
HomeController.cs
我想在 View 中使用以下文件夹结构,每个 View 都找到了您的 Controller :
/Views
/Blog
/Views
Index.aspx
Admin.aspx
Show.aspx
/Articles
Show.aspx
Admin.aspx
/Customers
/Sales
Index.aspx
Totals.aspx
/Products
Index.aspx
Promotions.aspx
/Home
Index.aspx
最佳答案
您可以使用路线来实现,即
routes.MapAreaRoute("Blogs",
"Blog/Views/{controller}/{action}/{id}",
new { controller = "Views", action = "Index", id = "" });
鉴于上述数据,这似乎可以满足您的需求。
关于.net - 在 Controller 中创建子文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1748960/