框架中MVC路由该怎么配置

一个用户的请求到达MVC机制后,该是一个怎么样的机制来寻址,Web开发平台提供了路由配置表来统一管控这一过程。

默认的

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

伪静态的

routes.MapRoute(
name: "Article",
url: "index.html",
defaults: new { action = "Index", controller = "home", htmlname = UrlParameter.Optional },
constraints: new { action = "Index" }
);

框架中MVC路由该怎么配置

配置的

routes.MapLocalizedRoute("Product",
"{SeName}",
new { controller = "Product", action = "ProductDetails" },
new[] {"YunMFramework.Web.Controllers"});

配置的

 routes.MapLocalizedRoute("GetSampleDownload",
"download/sample/{type}/{id}",
new { controller = "Download", action = "Sample" },
new { type=@"\d+",id = @"\d+" },
new[] { "YunMFramework.Web.Controllers" });

本站文章除注明转载外,均为本站原创或翻译,欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,共创和谐网络环境。
转载请注明:文章转载自:华晨软件-云微开发平台 » 框架中MVC路由该怎么配置
本文标题:框架中MVC路由该怎么配置
本文地址:https://www.hocode.com/QAPrefecture/0001.html

相关文章: 深圳开发平台 ¦ 深入Web框架-MVC自定义Route让Url更优雅 ¦ 框架中MVC路由该怎么配置

电话
电话 18718672256

微信
二维码