Created
February 11, 2013 15:36
-
-
Save nul800sebastiaan/4755162 to your computer and use it in GitHub Desktop.
Register Web API route in Umbraco 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| using System.Web.Http; | |
| using System.Web.Routing; | |
| using Umbraco.Core.Events; | |
| using Umbraco.Core.Models; | |
| using Umbraco.Core.Publishing; | |
| using umbraco.interfaces; | |
| namespace Site.EventHandlers | |
| { | |
| public class StartupEventHandlers : IApplicationStartupHandler | |
| { | |
| public StartupEventHandlers() | |
| { | |
| Umbraco.Web.UmbracoApplication.ApplicationStarting += | |
| UmbracoApplicationStarting; | |
| } | |
| static void UmbracoApplicationStarting(object sender, System.EventArgs e) | |
| { | |
| RouteTable.Routes.MapHttpRoute( | |
| name: "DefaultApi", | |
| routeTemplate: "api/{controller}/{id}", | |
| defaults: new { id = RouteParameter.Optional } | |
| ); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment