黑马程序员技术交流社区

标题: MVC路由示例 [打印本页]

作者: sunrise2    时间: 2014-8-11 09:18
标题: MVC路由示例
简单常用的MVC路由
  1. routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

  2.             routes.MapRoute(
  3.                 name: "scholarinfo",
  4.                 url: "{controller}/{id}",
  5.                 defaults: new { Controller = "scholar", action = "Info" }
  6.             );
  7.             routes.MapRoute(
  8.                 name: "controllerdefault",
  9.                 url: "{Controller}",
  10.                 defaults: new { action = "Index" }
  11.             );
  12.             routes.MapRoute(
  13.                 name: "root",
  14.                 url: "",
  15.                 defaults: new {controller = "scholar", action = "index" }
  16.             );

复制代码






欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2