Routing (RoutingHandler.cs)

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.
1/23/2014 2:58:11 PM
Gravatar
Total Posts 190

Routing (RoutingHandler.cs)

Just curious if this is still intended for use. I added a config file some time ago in the Setup folder that was working fine at the time. Now I only seem to be able to get a 404 error.

Thanks

1/23/2014 3:03:50 PM
Gravatar
Total Posts 18439

Re: Routing (RoutingHandler.cs)

Nothing has changed in it, if it worked before it should work now as far as I know. It isn't something used currently in features we ship but it worked when I implemented it way back and it hasn't been changed so it should still work as far as I know.

1/23/2014 3:08:14 PM
Gravatar
Total Posts 190

Re: Routing (RoutingHandler.cs)

OK, thanks Joe. I'll put some breakpoints in the handler and see if I can nail down the issue. I'll put the resolution here if I find something in case someone else runs into the same thing.

1/23/2014 3:11:50 PM
Gravatar
Total Posts 18439

Re: Routing (RoutingHandler.cs)

It would require adding this in user.config since it is disabled by default given that we don't use it for anything we ship.

<add key="EnableRouting" value="true" />

and of course changes in user.config are not automatically detected so you must also touch web.config after adding that setting.

The main reason we don't use routing for anything important in mojoportal is because routing is pattern based and since we support multiple sites based on folder names it kind of makes the pattern ambiguous if the root site needs /somefolder/ and but child sites have the first segment as the site folder like /sitefolder/somefolder/ would be the pattern for a folder site. This gives the first segment 2 different meanings so it can't be used very well unless not using folder based child sites, and since we don't want to break folder based child sites we just haven't used routes for anything so far given that our whole url rewriting friendly url system was developed long before asp.net routing ever existed.

1/23/2014 3:31:30 PM
Gravatar
Total Posts 190

Re: Routing (RoutingHandler.cs)

Bingo! It was the app setting I lost track of. Yes, I do see where that could be trouble in mojoPortal. I, however, had implemented this routing feature for a custom application (the schedules on the Metro Transit site), which I think is just the type of thing you had in mind for it. I hope to be rolling this out soon. Thanks!

1/23/2014 7:08:57 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

Re: Routing (RoutingHandler.cs)

I was just going to post a threat on using this as well!  Good timing!  Thanks Joe and John!

1/24/2014 12:24:43 PM
Gravatar
Total Posts 18439

Re: Routing (RoutingHandler.cs)

Thanks for the beers Matt! Much appreciated.!

I've just created a documentation page Using ASP.NET Routing in mojoPortal to make it easier for developers to find this information.

1/24/2014 11:50:39 PM
Gravatar
Total Posts 111
Matt Millican InternetMill

Re: Routing (RoutingHandler.cs)

No problem Joe! I meant to a couple weeks ago and kept forgetting!  

Thanks much!  The routes are working perfectly for my particular scenario!

8/13/2014 8:56:55 AM
Gravatar
Total Posts 190

Re: Routing (RoutingHandler.cs)

Hi Joe,

Just installed 2.4.0.4 and routing isn't working. Is this no longer available? (or is there a change notice I didn't see? This is the feature that uses the config file in the Setup/Routes folder.)

Thanks,

John

8/13/2014 9:17:34 AM
Gravatar
Total Posts 18439

Re: Routing (RoutingHandler.cs)

Hi John,

In 2.4.0.4 we did change the way routes are registered as we added support also for web api routes and wanted to have a consistent way to register routes. We dropped routing from our .NET 4 build because we use new .NET 4.5 classes for routing and web api.

To plugin custom routes now you implement this IRegisterRoute interface which has methods for mvc routes, api routes and filters to be registered, you can just do nothing in the methods that aren't of interest.

An example implementation is in the mojoPortal.Features project where we add an api route for forum notification moderation.

whatever class/type/namespace where you implement the interface, you plug that in by adding a config file under /Setup/RouteRegistrars that declares the type

Then the methods on your RouteRegistrar will be called during application start.

Sorry for the breaking change, I didn't think many people were using the routing feature. It is pretty straightforward to implement the new way. If you have any trouble making the needed changes let me know and I'll try to help.

Best,

Joe

 

8/13/2014 10:24:34 AM
Gravatar
Total Posts 190

Re: Routing (RoutingHandler.cs)

Thanks, Joe. I'll work on getting my code updated. Doesn't sound like a big deal.

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