标签:http os io ar cti sp new on ef
《1》
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace MvcFirst
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//注册一条路由规则
routes.MapRoute(
name: "Default", //路由的名字,就相当于KEY
url: "{controller}/{action}/{id}", //路由的格式,即URL地址的格式;{}就代表了一个占位符,{controller}相当于http://localhost:1337/Home ;{action}就是Index
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }//假设你不写全这个路由名称的话:仅仅这样写成http://localhost:1337/ 这样; 这个是默认值;controller = "Home"就代表了默认为Home这个控制器,action = "Index"就代表了默认为Index这个方法。也就是说它默认的实际路由是http://localhost:1337/Home/Index
);
}
}
}标签:http os io ar cti sp new on ef
原文地址:http://blog.csdn.net/fanbin168/article/details/38822845