如何在MVC中为子文件夹进行URL路由? [英] How can I make URL routing for subfolders in MVC?
本文介绍了如何在MVC中为子文件夹进行URL路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Asp.net MVC4的新手,我需要为下面提到的文件夹结构定义溃败,
意见/主页(所需网址:/主页)
查看/管理员/ CorePages /城市(所需网址:/ Admin / CorePages / City)
主页网址路由工作完美,但对于子文件夹,如 Admin / CorePages / City它不是根据URL路由,我如何创建路由?
注意:我的控制器在控制器文件夹中以相同的方式放置。
I am new to the Asp.net MVC4 , I need to define rout for folder structure mention below,
Views/Home (Desired URL: /Home)
Views/Admin/CorePages/City (Desired URL: /Admin/CorePages/City)
for "Home" URL routing working perfect but for sub-folder such as "Admin/CorePages/City" it is not routing as per URL,How do I create route?
Note: My Controller are place in same manner in controller folder.
推荐答案
您应该考虑使用区域:
ASP.NET MVC 4中的范围 [ ^ ]
You should look into using Areas:
Areas in ASP.NET MVC 4[^]
这篇关于如何在MVC中为子文件夹进行URL路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文