Adding Routes (WCF RESTFUL)

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
11/21/2010 4:55:54 PM
Gravatar
Total Posts 70

Adding Routes (WCF RESTFUL)

Hi Joe,

Just done some researching in mojo's code and found that we can add routes using .config files (RoutingHandler.cs). I was wondering how to add the following route without changing the global.asax. From now, I'll let the code on Global.asax. Is there another way?

This is a sample of the routes I'm working with:

RouteTable.Routes.Add(new ServiceRoute("service1", new WebServiceHostFactory(), typeof(Service1)));

11/22/2010 7:23:21 AM
Gravatar
Total Posts 18439

Re: Adding Routes (WCF RESTFUL)

Hi Bruno,

If you know the urls and handlers you can declare routes by patterns in config files that can be dropped into the /Setup/Routes folder. There is a file there named mojoRoutes.config that has example syntax for declaring routes. You can add additional files to declare custom routes in that folder using the example syntax.

I don't have a way for you to add routes programmatically as in the syntax you posted. That is one of the integration issues of routing that they can only be added from application_start in global.asax so typically one would have to recompile in order to add routes.

The solution you found in mojoPortal routing is recent work I did to make it possible to add routes without recompiling by using config files to declare route patterns. Routes are not currently used yet in mojoPortal but I plan to try to use it when I make the new tagging/category system in order to have seo friendly urls for tags/category lists. I have tested it with experimental code in the /Bog/ViewCategory.aspx page but I commented it out there because I was only testing for proof of concept to make sure I could get it working.

Best,

Joe

 

You must sign in to post in the forums. This thread is closed to new posts.