Have the same questions here. Did you ever figure this out?
It seems if you've installed the site from binaries, there is no global.asax.cs code behind, which i'm guessing is compiled into one of the DLLs so thus we need to provide our own. I was looking at this page http://our.umbraco.org/documentation/reference/mvc/custom-routes but it doesn't go into enough detail. Was just wondering what others have been doing. Thanks!
The plot thickens. Cannot even find any file named "global.asax.cs" in the latest source code; will try just dumping in one from a new MVC project, but surely there must be some base routing Umbraco needs to start with?
Following up for posterity: Nick is correct, you will want to create your own custom class that inherits from Umbraco.Web.UmbracoApplication and the implement the override for the OnApplicationStarted event as he showed above. If you installed Umbraco from binaries (rather than working with umbraco inside of a Visual Studio project) you can put this file into the magic /App_Code folder for it to be recognized.
I'm not sure if that's all you need to do, but what I've also been doing for good measure is changing the "global.asax" markup (NOT its .cs code-behind that we're talking about, but the one-line file that appears in the site root) and change the "Inherits" attribute from Umbraco.Web.UmbracoApplication to whatever you named your custom class, e.g., Inherits="MyCustomUmbracoApplication".
I'm having the same issue by migrating from 4.9.0 to 4.11.10. I have a custom Global.asax file as shown below, with the Application_BeginRequest filled with my code:
public class Global : Umbraco.Web.UmbracoApplication
{
public void Init(HttpApplication application)
{
application.PreRequestHandlerExecute += new EventHandler(application_PreRequestHandlerExecute);
application.EndRequest += (new EventHandler(this.Application_EndRequest));
//application.Error += new EventHandler(Application_Error); // Overriding this below
Despite all my attempts I continue to have a "Object reference not set to an instance of an object" issue on my home page in the following umbraco event:
Custom Global.asax class (4.11)
So do I just have to change the reference in the global.asax file to use this instead of the global.asax.cs code behind?
Have the same questions here. Did you ever figure this out?
It seems if you've installed the site from binaries, there is no global.asax.cs code behind, which i'm guessing is compiled into one of the DLLs so thus we need to provide our own. I was looking at this page http://our.umbraco.org/documentation/reference/mvc/custom-routes but it doesn't go into enough detail. Was just wondering what others have been doing. Thanks!
The plot thickens. Cannot even find any file named "global.asax.cs" in the latest source code; will try just dumping in one from a new MVC project, but surely there must be some base routing Umbraco needs to start with?
Hi yes I did work it out you need to create a new class that inherits from Umbraco.Web.UmbracoApplication
publicclassdiam_planogram : Umbraco.Web.UmbracoApplication
{
protected override void OnApplicationStarted(object sender, EventArgs e)
{
base.OnApplicationStarted(sender, e);
}
}
Following up for posterity: Nick is correct, you will want to create your own custom class that inherits from Umbraco.Web.UmbracoApplication and the implement the override for the OnApplicationStarted event as he showed above. If you installed Umbraco from binaries (rather than working with umbraco inside of a Visual Studio project) you can put this file into the magic /App_Code folder for it to be recognized.
I'm not sure if that's all you need to do, but what I've also been doing for good measure is changing the "global.asax" markup (NOT its .cs code-behind that we're talking about, but the one-line file that appears in the site root) and change the "Inherits" attribute from Umbraco.Web.UmbracoApplication to whatever you named your custom class, e.g., Inherits="MyCustomUmbracoApplication".
Hi all,
I'm having the same issue by migrating from 4.9.0 to 4.11.10. I have a custom Global.asax file as shown below, with the Application_BeginRequest filled with my code:
public class Global : Umbraco.Web.UmbracoApplication
{
public void Init(HttpApplication application)
{
application.PreRequestHandlerExecute += new EventHandler(application_PreRequestHandlerExecute);
application.EndRequest += (new EventHandler(this.Application_EndRequest));
//application.Error += new EventHandler(Application_Error); // Overriding this below
}
private void application_PreRequestHandlerExecute(object sender, EventArgs e)
{
}
private void Application_BeginRequest(object sender, EventArgs e)
{
ERAUtils.RewriteURL();
}
private void Application_EndRequest(object sender, EventArgs e)
{
}
protected new void Application_Error(object sender, EventArgs e)
{
}
protected override void OnApplicationStarted(object sender, EventArgs e)
{
base.OnApplicationStarted(sender, e);
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
}
I also properly changed the markup of the Global.asax into:
<%@ Application Codebehind="Global.asax.cs" Inherits="Global" Language="C#" %>
Despite all my attempts I continue to have a "Object reference not set to an instance of an object" issue on my home page in the following umbraco event:
Any suggestions?
Thank you very much in advance to all of you...
is working on a reply...