.Net MVC 伪路由 基础
1、创建个.net mvc 项目
2、打开App_Start文件夹下面的RouteConfig类
3、把下面代码粘贴复制进去
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default2", // action伪静态
"home/{action}.html",// 带有参数的 URL
new { controller = "home", action = "index", id = UrlParameter.Optional }// 参数默认值
);
routes.MapRoute(
"Default_id", // action伪静态
"{action}/{id}.html",// 带有参数的 URL
new { controller = "home", action = "index", id = UrlParameter.Optional }// 参数默认值
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
4、最后一步设置web.comfig
在<system.webServer>下面添加上下面这个标签
<modules runAllManagedModulesForAllRequests="true"></modules>
这样就可以了 ;这只是最基础的 还有复杂的。看了很多做推广的网站上面的分页什么的

浙公网安备 33010602011771号