MVC伪静态路由简单搭配
2024-09-05 21:04:17
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Root",
"",
new {controller = "Home", action = "Index", id = UrlParameter.Optional},
namespaces: new string[] { "Jxrlzy.Controllers" }
); //根目录匹配
routes.MapRoute(
"Controller1Html", // action伪静态
"{controller}.html", // 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值
namespaces: new string[] { "Jxrlzy.Controllers" }
);
routes.MapRoute(
"Action1Html", // action伪静态
"{controller}/{action}.html", // 带有参数的 URL
new {controller = "Home", action = "Index", id = UrlParameter.Optional}, // 参数默认值
namespaces: new string[] {"Jxrlzy.Controllers"}
);
routes.MapRoute(
"Action", // action伪静态
"{controller}/{action}", // 带有参数的 URL
new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // 参数默认值
namespaces: new string[] { "Jxrlzy.Controllers" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}.html",
defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional},
namespaces: new string[] {"Jxrlzy.Controllers"}
);
ModelBinders.Binders.Add(typeof(JObject), new JObjectModelBinder());
}
最新文章
- Xcode最好用的日志打印方法
- JavaScript高阶函数
- ActiveMQ第六弹:设置多个并行的消费者
- SequenceInputStream
- HTK搭建语音拨号系统实验材料下载
- Android 中ViewPagerIndicator的使用
- 刀哥多线程现操作gcd-10-delay
- elasticsearch中的mapping映射配置与查询典型案例
- css笔记11:选择器练习
- vim全局替换
- Jsoup 解析 HTML
- NYOJ 284 坦克大战 【BFS】+【优先队列】
- struts2原理分析
- 爬虫实战:爬虫之 web 自动化终极杀手 ( 上)
- [GitHub]第二讲:GitHub客户端
- 树莓派.系统.官方下载中NOOBS和Raspbian的区别
- PHP 中move_uploaded_file 上传中文文件名失败
- 更换Appsecrect应该要注意的问题
- Linux学习---指针运算、修饰符(const、volatile、typedef)及、运算符(++、--、+、-)
- grep正则表达式搜索
热门文章
- 【Android】【问题解决记录】Error obtaining UI hierarchy :Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
- DVWA的搭建
- mysql 单表,多表,符合条件,子查询
- Python基础之输出格式和If判断
- 排序算法-桶排序(Java)
- 非vue等框架中html 中使用es6的模块用法小结
- celery工作原理介绍
- css 水平垂直居中两种常用方式
- Salesforce 开发整理(二)报表开发学习
- k8s 相关的命令