示例#1
0
        /// <summary>
        /// Application BeginRequest
        /// </summary>
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            try {
                if (HttpContext.Current != null)
                {
                    if (HttpContext.Current.Request.Cookies["UICulture"] == null)
                    {
                        HttpContext.Current.Response.Cookies["UICulture"].Value   = System.Web.Configuration.WebConfigurationManager.AppSettings["UICulture"];
                        HttpContext.Current.Response.Cookies["UICulture"].Expires = DateTime.Now.AddDays(30);
                    }

                    if (HttpContext.Current.Request.Cookies["UICulture"] != null)
                    {
                        var lang = HttpContext.Current.Request.Cookies["UICulture"].Value;
                        if (!String.IsNullOrEmpty(lang))
                        {
                            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(lang);
                            System.Threading.Thread.CurrentThread.CurrentCulture   = System.Globalization.CultureInfo.CreateSpecificCulture(lang);
                        }
                    }

                    var thisPage = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path);
                    if (thisPage.ToLower().EndsWith(".aspx"))
                    {
                        if (!InstallerHelper.ConnectionStringIsSet())
                        {
                            InstallerHelper.RedirectToInstallationPage(null);
                        }

                        if (thisPage.ToLower().EndsWith("login.aspx"))
                        {
                            if (!InstallerHelper.LscDataIsSet())
                            {
                                InstallerHelper.RedirectToInstallationPage(new string[] { "_sl=1" });
                            }
                        }
                    }
                }
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), "System");
            }
        }