Currently I've read this resource http://www.bugdebugzone.com/2014/06/tutorial-how-to-make-ajax-call-in.html on how to make ajax calls with Sitecore. But I can see this getting out of hand as far as adding Routes to the Routes.config. What alternatives are there to adding routes to the config? Or maybe some way to read them in from a config file? Is there perhaps some "natural" way for Sitecore to pick up the controller and action?
2条回答 默认 最新
- weixin_33711641 2016-05-13 06:58关注
Sitecore way to register routes is do the same that is described in article, but call it not from App_start folder. It should be called from one of processors in initialize pipeline.
As example you could open your /sitecore/admin/showconfig.aspx, find initialize pipeline definition and look on Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc, Sitecore.Cintel.Client.Initialization.InitializeRoutes, Sitecore.Cintel.Client or Sitecore.Cintel.Endpoint.Plumbing.InitializeRoutes, Sitecore.Cintel processors. Actually they do the same that is described in article that you have provided, difference is only in place where it is called.
P.S. As for me call from initialize pipeline have one benefit: you can control order of routes collection.
解决 无用评论 打赏 举报