ASP.NET MVC 路由配置 管线模式伪静态
2015-07-23 09:22
253 查看
这种方法只能在iis7以上iis使用。
web.config 配置
<httpHandlers>
<add verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" path="*.html" type="System.Web.StaticFileHandler"/>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
默认控制器 /控制器方法/参数
routes.MapRoute(
name: "Default",
url: "{action}.html",
defaults: new { controller = "Home", action = "Index" }
);
routes.MapRoute(
name: "DefaultOptional",
url: "{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
加上控制器访问 控制器/控制器返回方法/参数
routes.MapRoute(
name: "Default",
url: "{controller}/{action}.html",
defaults: new { controller = "Home", action = "Index" }
);
routes.MapRoute(
name: "DefaultOptional",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
web.config 配置
<httpHandlers>
<add verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" path="*.html" type="System.Web.StaticFileHandler"/>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
默认控制器 /控制器方法/参数
routes.MapRoute(
name: "Default",
url: "{action}.html",
defaults: new { controller = "Home", action = "Index" }
);
routes.MapRoute(
name: "DefaultOptional",
url: "{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
加上控制器访问 控制器/控制器返回方法/参数
routes.MapRoute(
name: "Default",
url: "{controller}/{action}.html",
defaults: new { controller = "Home", action = "Index" }
);
routes.MapRoute(
name: "DefaultOptional",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
相关文章推荐
- asp,mdb,工具
- ASP.NET MVC 大文件 分块上传
- 轻量级、高性能SQL ORM 之 SqlSugar - ASP.NET
- Asp.Net 如何调用js中的函数function ?
- struts2与JasperReport整合应用中解决PDF中文不显示问题(让我烦恼了半天)
- metasploit常用命令
- [ASP.NET MVC 小牛之路]07 - URL Routing
- ASP.Net MVC3 - The easier to run Unit Tests by moq #Reprinted#
- 【工作笔记0001】(asp.net )从客户端中检测到有潜在危险的 Request.Form 值
- 微软发布ASP.NET 5路线图
- asp:Repeater中实现隔行换色
- ASP.NET 5新特性
- ASP.NET 5 将于2016年一季度发布
- ASP.NET仿新浪微博下拉加载更多数据瀑布流效果
- 【asp】asp网页utf-8乱码解决方法
- asp利用winrar解压缩文件
- asp.net MVC 3/4 equivalent to a response.filter
- ASP.NET中图片显示方法实例
- ASP.NET MVC4中调用WEB API的四个方法
- GridView、Repeater合并单元格