using System; using System.Configuration; using System.Security; using System.Web.Security; using Website.DataAccess; using Website.EnterpriseLibrary; namespace Website { public class GlobalApplication : System.Web.HttpApplication { private static IIoCContainer container; public static IIoCContainer Container { get { return container; } private set { container = value; } } protected void Application_Start() { ConfigureXmlContentProviderPath(); Container = new UnityIoCContainer(); new ApplicationRoutes(System.Web.Routing.RouteTable.Routes).Register(); } void ConfigureXmlContentProviderPath() { // Convert the relative file path to a server file path var filePath = Server.MapPath(Parse.AppSetting(XmlContentProvider.FILE_PATH_APP_SETTING)); ConfigurationManager.AppSettings.Set(XmlContentProvider.FILE_PATH_APP_SETTING, filePath); } protected void Application_Error(object sender, EventArgs e) { var ex = Server.GetLastError().GetBaseException(); if (ex is SecurityException) { FormsAuthentication.RedirectToLoginPage(); Server.ClearError(); return; } } } }