Umbraco 4.10 + Extending Global.ascx

extend, global-asax, routes, umbraco

Solution

You are certainly on the right path. You can do it in a similar way to how you normally would:

protected override void OnApplicationStarted(object sender, EventArgs e)
{
    base.OnApplicationStarted(sender, e);

    RegisterRoutes(RouteTable.Routes);

}

public static void RegisterRoutes(RouteCollection routes)
{
    routes.MapRoute("SitemapXml", "sitemap.xml", new { controller = 
        "SitemapSurface", action = "XmlSitemap" });
}

Problem

Does anyone knows how to extend Global.ascx in umbraco 4.10 onwards? I want to register custom routes to my application. I have added code behind to the global.ascx and inherited as follows: ``` public class Global : Umbraco.Web.UmbracoApplication { protected override void OnApplicationStarting(object sender, EventArgs e) { base.OnApplicationStarting(sender, e); } //protected void Application_Start(object sender, EventArgs e) //{ //}..... ``` Please correct if I understood this wrong and you can not extend global.ascx file. Edit: I know you can do this with config but I think it would be much better to do in global.ascx to do complex routing in future. Many Thanks.

Original source