Lullaby service URL routing

written by Ryan Olshan on Wednesday, September 17 2008

Lullaby beta 3 introduces a service URL routing featuring. Using this feature, you can call a REST service by service name without needing to use an ASHX handler. For example, a Lullaby REST service previously accessable with an ASHX handler at http://mysite.com/rest.asxh can now be accessable via http://mysite.com/rest.

To use service URL routing instead of an ASHX handler, you'll need to do the following:

Add a reference to System.Web.Routing.

Add the following HTTP module to web.config:

<add name="Routing"

          type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

In Global.asax for the REST service, add the following to Application_Start.

        using System.Web.Routing;

       

        protected void Application_Start(object sender, EventArgs e)

        {

            var route = new Route("myservicename/{*path}", new RestRouteHandler("myservicename"));

            RouteTable.Routes.Add(route);

        }

Kick this post on .NET Kicks

Similar Posts

  1. Introducing Lullaby
  2. Lullaby's authentication provider framework
  3. MagicAjax - Easy as 1, 2, 3

Post a comment