mvc中,MapRoute如何将url:http://xxx.com/list/readlist/1,写成http://xxx.com/list/1
http://xxx.com/bbslist/readlist/1解释一下:
http://xxx.com/ 是网站
bbslist 是controller(论坛帖子的列表)
readlist 是action,list controller中的一个actionResult
1 是分页的页码
目前生成的url太难看了!!!
能不能就直接生成http://xxx.com/bbslist/1 也就是说,不显示action
或者是http://xxx.com/readlist/1,也就是说不显示controller
我在下面试了,但是不行!
Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.MapRoute(
name:="bbs",
url:="{controller}/{action}/{id}",
defaults:=New With {.controller = "bbslist", .action = "readlist", .id =UrlParameter.Optional})
End Sub
补充:.NET技术 , ASP.NET