Global.asax.cs :  » Content-Management-Systems-CMS » umbraco » presentation » umbracoBase » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Content Management Systems CMS » umbraco 
umbraco » presentation » umbracoBase » Global.asax.cs
using System;
using System.Web;
using System.Threading;

using umbraco.BusinessLogic;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.businesslogic.datatype.controls;
using umbraco.cms.businesslogic.stat;

namespace umbraco{
  /// <summary>
  /// Summary description for Global.
  /// </summary>
  public class Global : HttpApplication
  {
    protected Timer publishingTimer;
    protected Timer pingTimer;

    public Global()
    {
      InitializeComponent();
    }

        //protected void Application_Start(Object sender, EventArgs e)
        //{
        //    try
        //    {
        //        Log.Add(LogTypes.System, BusinessLogic.User.GetUser(0), -1, "Application started at " + DateTime.Now);
        //    }
        //    catch
        //    {
        //    }

        //    // Check for configured key
        //    if(!GlobalSettings.Configured)
        //    {
        //        Application["umbracoNeedConfiguration"] = "true";
        //    }
        //    else
        //    {
        //        // add current default url
        //        Application["umbracoUrl"] = string.Format("{0}:{1}{2}",
        //            this.Context.Request.ServerVariables["SERVER_NAME"],
        //            HttpContext.Current.Request.ServerVariables["SERVER_PORT"], GlobalSettings.Path);

        //        /* This section is needed on start-up because timer objects
        //         * might initialize before these are initialized without a traditional
        //         * request, and therefore lacks information on application paths */

        //        // initialize datatype factory
        //        new Factory();

        //        // initialize action handlers
        //        Action.registerActionHandlers();

        //        /* Initialize SECTION END */

        //        // Start ping / keepalive timer
        //        pingTimer = new Timer(new TimerCallback(keepAliveService.PingUmbraco), this.Context, 1000, 300000);

        //        // Start publishingservice
        //        publishingTimer = new Timer(new TimerCallback(publishingService.CheckPublishing), this.Context, 1000, 60000);
        //    }
        //}

    protected void Session_Start(Object sender, EventArgs e)
    {
      if(GlobalSettings.EnableStat)
      {
        try
        {
          new Session();
        }
        catch(Exception state)
        {
                    Log.Add(LogTypes.Error, BusinessLogic.User.GetUser(0), -1, "Error initializing stat: " + state);
        }
      }
    }

        //protected void Application_BeginRequest(Object sender, EventArgs e)
        //{
        //    if(HttpContext.Current.Request.Path.ToLower().IndexOf(".aspx") > -1 ||
        //        HttpContext.Current.Request.Path.ToLower().IndexOf(".") == -1)
        //    {
        //        // Check if path or script is reserved!
        //        bool urlIsReserved = false;
        //        if(GlobalSettings.ReservedUrls.ToLower().IndexOf(string.Format(", {0}, ",
        //            HttpContext.Current.Request.Path.ToLower())) > -1)
        //            urlIsReserved = true;

        //        string[] reservedPaths = GlobalSettings.ReservedPaths.Split(',');
        //        for(int i = 0; i < reservedPaths.Length; i++)
        //        {
        //            if((HttpContext.Current.Request.Path).ToLower().StartsWith(reservedPaths[i].Trim().ToLower()))
        //            {
        //                urlIsReserved = true;
        //            }
        //        }

        //        if(!urlIsReserved)
        //        {
        //            if(Application["umbracoNeedConfiguration"] != null)
        //                HttpContext.Current.Response.Redirect(string.Format("{0}/../install/default.aspx?redir=true",
        //                    GlobalSettings.Path), true);
        //            else if(content.Instance.isInitializing)
        //                HttpContext.Current.RewritePath(string.Format("{0}/../config/splashes/booting.htm",
        //                    GlobalSettings.Path));
        //            else
        //            {
        //                string path = HttpContext.Current.Request.Path;
        //                string query = HttpContext.Current.Request.Url.Query;
        //                if(query != null && query != "")
        //                {
        //                    // Clean umbPage from querystring, caused by .NET 2.0 default Auth Controls
        //                    if(query.IndexOf("umbPage") > 0)
        //                    {
        //                        query += "&";
        //                        path = query.Substring(9, query.IndexOf("&") - 9);
        //                        query = query.Substring(query.IndexOf("&") + 1, query.Length - query.IndexOf("&") - 1);
        //                    }
        //                    else if(query.Length > 0)
        //                        query = query.Substring(1, query.Length - 1);

        //                    if(query.Length > 0)
        //                    {
        //                        HttpContext.Current.Items["VirtualUrl"] = path + "?" + query;
        //                        HttpContext.Current.RewritePath(string.Format("{0}/../default.aspx?umbPage={1}&{2}",
        //                            GlobalSettings.Path, path, query));
        //                    }
        //                }
        //                if(HttpContext.Current.Items["VirtualUrl"] == null)
        //                {
        //                    HttpContext.Current.Items["VirtualUrl"] = path;
        //                    HttpContext.Current.RewritePath(string.Format("{0}/../default.aspx?umbPage={1}",
        //                        GlobalSettings.Path, path));
        //                }
        //            }
        //        }
        //    }
        //}

    protected void Application_EndRequest(Object sender, EventArgs e)
    {
    }

    protected void Application_AuthenticateRequest(Object sender, EventArgs e)
    {
    }

        //protected void Application_Error(Object sender, EventArgs e)
        //{
        //    if(Request != null)
        //        Log.Add(LogTypes.Error, BusinessLogic.User.GetUser(0), -1,
        //            string.Format("At {0} (Refered by: {1}): {2}",
        //                this.Request.RawUrl, this.Request.UrlReferrer, this.Server.GetLastError().InnerException));
        //    else
        //        Log.Add(LogTypes.Error, BusinessLogic.User.GetUser(0), -1,
        //            "No Context available -> " + Server.GetLastError().InnerException);
        //}

    protected void Session_End(Object sender, EventArgs e)
    {
      //if(GlobalSettings.EnableStat)
      //    cms.businesslogic.stat.Session.EndSession(new Guid(Request.Cookies["umbracoSessionId"].Value));
    }

    protected void Application_End(Object sender, EventArgs e)
    {
            Log.Add(LogTypes.System, BusinessLogic.User.GetUser(0), -1, "Application shutted down at " + DateTime.Now);
    }

    #region Web Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      
    }

    #endregion
  }
}

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.