How to get WebORB and ASP.NET MVC to work together.

As mentioned before, I have been writing some RIA applications using Flex. I've also been playing with ASP.NET MVC. I have one project where I am considering combining the two.

I have been using WebORB from MidnightCoders as my communication layer between .NET and Flex. I've been really happy with it. It does not, however, work properly with the ASP.NET MVC framework. When you copy the WebORB bits into the web application, and try to browse the console, you get the "Oops, something went wrong..." error.


I suspected early on that I needed to add an IgnoreRoute statement to the RegisterRoutes method of the global.asax.cs, but was not sure of the exact syntax to use in this case. Since this took me longer than I care to admit to figure out, I’m willing to bet someone else may run into this.

I first tried to add the following statement:


That resulted in weborb working, but left routing broken. I got 404 errors for any controller method that had previously worked. I tried several other permutations, but did not get anything to work properly until I found this post from Phil, Make Routing Ignore Requests For A File Extension. Using the technique that Phil used, I was able to get routing to work properly.

Here is my final RegisterRoutes method that got me up and running:

   1: public static void RegisterRoutes(RouteCollection routes)
   2: {
   3:     routes.IgnoreRoute("{*weborb}", new { weborb = @".*weborb\.aspx(/.*)?" });
   4:     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
   5:     routes.MapRoute(
   6:         "Default",
   7:         "{controller}/{action}/{id}",
   8:         new { controller = "Home", action = "Index", id = "" }
   9:     );
  10: }
kick it on