public class EventHandler : IApplicationEventHandler
{
public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
//throw new NotImplementedException();
}
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
WebApiConfig.Register(GlobalConfiguration.Configuration);
}
public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
//throw new NotImplementedException();
}
}
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "CustomApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
Urlrewrite API call
I have this api call http://domain/umbraco/api/shopapi/GetByid/[ID] but I want to use urlrewriting to use http://domain/api/shopapi/GetByid/[ID] instead.
I have been trying the rewriting in web.config and I have right now
I have never been good at rewriting so I need some help here.
I was thinking about using the IContentFinder instead but I need to map that to a url instead of outputting the string i get.
Ok I solved it using
public class EventHandler : IApplicationEventHandler { public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) { //throw new NotImplementedException(); }
is working on a reply...