Is it possible to use System.Web.Routing in Castle Monorail?

a 夏天 提交于 2019-12-13 00:38:44

问题


Is it possible to use the Microsoft (or Mono) supplied System.Web.Routing instead of the MonoRail routing stuff when building a Castle MonoRail app for ASP.NET? Any good information on how to implement this as a solution? Pros and cons?


回答1:


It is quite possible. You should implement ASP.NET's IRouteHandler that will look up the route data in the given RequestContext, and then hand the data over to MonoRail.

That can be done is several ways. I guess that Server.RewritePath will work, but you can more cleanly lookup the code in two classes of MonoRail, namely MonorailHttpHandlerFactory and RoutingModuleEx, to figure out how to return set the needed things on the MonoRailHttpHandler you'll return from the IRouteHandler.

As for problems - it would be very tricky to to the reverse, i.e. generate routes from controller actions.



来源:https://stackoverflow.com/questions/3302345/is-it-possible-to-use-system-web-routing-in-castle-monorail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!