我目前正在开发一个具有三个 UserTypes 的 asp.net mvc 应用程序。1) 管理员 2) 学校 3) 家长
我想用 3 个部分来装饰 URL,
like if it is admin then -> Admin/{Controller}/{Action}/{id}
if Shcool -> School/{Controller}/{Action}/{id}
if Parent - > Parent/{Controller}/{Action}/{id}
我试图将 routeconfig.cs 修改为
routes.MapRoute(
name: "Default",
url: "School/{controller}/{action}/{id}",
defaults: new { controller = "EstablishmentLogin", action = "Login", id = UrlParameter.Optional });
它有效,但问题是我曾经使用过 ajax 调用,我需要将 url 从 [{Controller}/{Action}/{id}] 修改为 [School/{controller}/{Action}/{id} ]。
找出所有 ajax 调用并修改 url 会很耗时。如果这个问题有任何替代方案,请建议我。
Also I want to Organize the folders Physically as
1)Admin -> Controllers
-> View
-> models
2)School - > Controllers
- > Views
-> Models`enter code here
3)Parent - > Controllers
- > Views
- > Models
How can i acheive this ?