1. Startup.cs 类的 Configure方法中, 加入Area路由设置代码:

  1. //app.UseMvcWithDefaultRoute();
  2. app.UseMvc(routes=> {
  3. // add the new route here.
  4. routes.MapRoute(name: "areaRoute",
  5. template: "{area:exists}/{controller}/{action}",
  6. defaults: new { controller = "Home", action = "Index" });
  7. routes.MapRoute(
  8. name: "default",
  9. template: "{controller}/{action}/{id?}",
  10. defaults: new { controller = "Home", action = "Index" });
  11. });

2. 创建Areas相关文件夹:

3. 在Area的Views目录下的_ViewStart.cshtml文件中, 指定Area的默认模板

4. 创建Area的Controller类:
  1. [Area("Admin")]
  2. public class HomeController: Controller
  3. {
  4. public IActionResult Login()
  5. {
  6. return View();
  7. }
  8. }
5. 创建_Layout.cshtml及View文件.

最新文章

  1. 查看Oracle执行计划
  2. Fragment之间传值
  3. aliyun阿里云Maven仓库地址——加速你的maven构建
  4. October 8th 2016 Week 41st Saturday
  5. 使用Visual Studio Code开发AngularJS应用
  6. python面试题大全(二)
  7. M面经Prepare: Positive-Negative partitioning preserving order
  8. .NET: WPF Data Binding
  9. ios第三方分享到qq、微信、人人网、微博总结
  10. TopCoder SRM 633div1
  11. sbrk and coreleft
  12. WinDBG调试.NET程序示例
  13. 【JAVAWEB学习笔记】08_MySQL&JDBC回顾
  14. 搭建ElasticSearch+MongoDB检索系统
  15. js生成json数据
  16. ruby读取源代码自身的一种方法
  17. MIPS 指令集开源了
  18. Redis 安装、配置、集群
  19. Regular Expression
  20. Expo大作战(二十)--expo中的Release channels(不重要*)

热门文章

  1. Unity3D学习笔记——NGUI之Localization system
  2. python3----智能检测编码的工具
  3. gtest入门简介
  4. rest-framework框架的基本组件分析
  5. python3 - property的使用
  6. FFmpeg总结(六)AV系列结构体之AVPacket
  7. Qt 静态编译后的exe太大, 能够这样压缩.
  8. [Spring Data Repositories]学习笔记--使用现有的repository
  9. 使用IDEA工具整合mybatis时使用@Resource和@Autowired自动注解bean时会显示红色问题的解决办法
  10. String、StringBuffer与StringBuilder的区别。