Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I'm trying to add a custom route based on the instructuions from here http://our.umbraco.org/documentation/Reference/Mvc/custom-routes
The problem is that OnApplicationStarted doesn't fire.
public class Global : Umbraco.Web.UmbracoApplication{ 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 = "SiteMapXmlSurface", action = "SiteMapXml" }); }}
Any ideas what I'm doing wrong? The site is on V 6.1.2.2 installed in an MVC 4 project as a NuGet package.
Thanks!
I'm having the exact same issue and cannot determine the cause. I'm on 6.1.3, also installed in an MVC4 project as a NuGet package.
Global.asax:
<%@ Application Codebehind="Global.asax.cs" Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %>
Global.asax.cs:
using NS3.WebApp;using System;using System.Web.Routing;public class Global : Umbraco.Web.UmbracoApplication{ protected override void OnApplicationStarted(object sender, EventArgs e) { base.OnApplicationStarted(sender, e); System.IO.File.WriteAllText("C:\\scripts\\blah.txt", "hello! " + DateTime.Now.ToString()); RouteConfig.RegisterRoutes(RouteTable.Routes); }}
I added the line to write to a file to confirm whether or not it was getting called. It is not getting called at all.
David
So close!
You need to update your Global.asax Inherits attribute to reference your new Global class.
e.g
<%@ Application Codebehind="Global.asax.cs" Inherits="MyNewApp.Global" Language="C#" %>
Hope that works :)
Thanks a lot Jade, that was it!
Success! Thanks Jade.
I have same parser error in umbraco v6 and I applied same solution but still get this error.
this does not work with Umbraco 7.3.1 ? any one can help me out...
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Extending Global.asax to create custom MVC routes
Hi,
I'm trying to add a custom route based on the instructuions from here http://our.umbraco.org/documentation/Reference/Mvc/custom-routes
The problem is that OnApplicationStarted doesn't fire.
Any ideas what I'm doing wrong? The site is on V 6.1.2.2 installed in an MVC 4 project as a NuGet package.
Thanks!
I'm having the exact same issue and cannot determine the cause. I'm on 6.1.3, also installed in an MVC4 project as a NuGet package.
Global.asax:
Global.asax.cs:
I added the line to write to a file to confirm whether or not it was getting called. It is not getting called at all.
David
So close!
You need to update your Global.asax Inherits attribute to reference your new Global class.
e.g
Hope that works :)
Thanks a lot Jade, that was it!
Success! Thanks Jade.
I have same parser error in umbraco v6 and I applied same solution but still get this error.
this does not work with Umbraco 7.3.1 ? any one can help me out...
is working on a reply...