Global.asax file is not working

Posted by Community Admin on 04-Aug-2018 07:36

Global.asax file is not working

All Replies

Posted by Community Admin on 30-Oct-2013 00:00

Hi,

We are trying to merge the publish code of an asp.net application with sitefinity cms app. After merging the code, the code written in Global.asax file in asp.net app stop working due to which URL rewriting and error handling concept given in Global.asax file fails. Kindly suggest how could we fix this.

Thanks in advance.

Posted by Community Admin on 30-Oct-2013 00:00

Alma,

If you have sample code we can try and help you some more.  But here is a successful global file we use.  Hopefully this helps!  Make sure you are building your solution after you modify your Global.asax.

using System;
using Aptera.Widgets.Configurations;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.GenericContent.Model;
using Telerik.Sitefinity.Modules.ControlTemplates;
using Telerik.Sitefinity.Modules.Pages;
using SitefinityWebApp.App_Code;
 
namespace SitefinityWebApp
    public class Global : System.Web.HttpApplication
    
 
        protected void Application_Start(object sender, EventArgs e)
        
            Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
        
 
        void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
        
            if (e.CommandName == "Bootstrapped")
            
                CreateWidgetTemplates();
                Config.RegisterSection<CalloutConfig>();
                Config.RegisterSection<FormsAskimetCredentials>();
            
 
            Telerik.Sitefinity.Scheduling.SchedulingManager schedulingManager = Telerik.Sitefinity.Scheduling.SchedulingManager.GetManager();
            string myKey = "RecurringScheduledTask";
            SitefinityWebApp.App_Code.RecurringScheduledTask newTask = new SitefinityWebApp.App_Code.RecurringScheduledTask()
            
                Key = myKey,
                ExecuteTime = DateTime.UtcNow.Subtract(TimeSpan.MaxValue),
            ;
            schedulingManager.AddTask(newTask);
            schedulingManager.SaveChanges();
        
 
        void CreateWidgetTemplates()
        
            PageManager pageManager = PageManager.GetManager();
            ControlTemplates.RegisterTemplatableControl(typeof(Aptera.Widgets.Callout), typeof(ContentItem), null, "Callouts", "Callouts");
            pageManager.SaveChanges();
        
 
        protected void Session_Start(object sender, EventArgs e)
        
 
        
 
        protected void Application_BeginRequest(object sender, EventArgs e)
        
 
        
 
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        
 
        
 
        protected void Application_Error(object sender, EventArgs e)
        
 
        
 
        protected void Session_End(object sender, EventArgs e)
        
 
        
 
        protected void Application_End(object sender, EventArgs e)
        
 
        
    

This thread is closed