URL routing broken in 5.1 upgrade

Posted by Community Admin on 04-Aug-2018 19:02

URL routing broken in 5.1 upgrade

All Replies

Posted by Community Admin on 06-Aug-2012 00:00

Been using  Bootstrapper_Initialized in our global.asax to use some of our own custom routes to go along side sitefinity's.

been working great for the past year or so, but its broken today after 5.1 upgrade.

We're doing whats almost identical on this thread:
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/custom-routing.aspx


error we are receiving after 5.1 upgrade is:

this line:

var routes = (System.Web.Routing.RouteCollection)args.Data;


Unable to cast object of type 'System.Linq.EnumerableQuery`1[System.Web.Routing.RouteBase]' to type 'System.Web.Routing.RouteCollection'.


any advice is appreciated 

Posted by Community Admin on 09-Aug-2012 00:00

bumping

How can i extend my own routes along side sitefinity 5.1?

thx

Posted by Community Admin on 16-Aug-2012 00:00

Use something like the following in your Bootstrapper_Initialized method--it worked for me:

var routes = ((EnumerableQuery<System.Web.Routing.RouteBase>)args.Data).ToList<System.Web.Routing.RouteBase>();
System.Web.Routing.Route newRoute = new System.Web.Routing.Route("Your Route Here", new YourCustomRouteHandler());
routes.Add(newRoute);

This thread is closed