/// <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"); } }
protected void Page_Load(Object sender, EventArgs e) { lblVersion.Text = String.Format("版本: {0}", GetNewVersion()); if (!Page.IsPostBack) { if (InstallerHelper.ConnectionStringIsSet() && InstallerHelper.LscDataIsSet()) { FormsAuthentication.RedirectToLoginPage(); return; } var checkPermission = Convert.ToBoolean(this.QueryStringInt("checkpermission", 1)); var testAgain = Convert.ToBoolean(this.QueryStringInt("testagain", 0)); var rootDir = HttpContext.Current.Server.MapPath("~/"); var dirsToCheck = new List <string>(); dirsToCheck.Add(rootDir); dirsToCheck.Add(rootDir + "Install\\Scripts"); dirsToCheck.Add(rootDir + "Logs\\RUN"); dirsToCheck.Add(rootDir + "TempImages"); foreach (var dir in dirsToCheck) { if (!checkPermissions(dir, true, true, true, true) && checkPermission) { pnlWizard.Visible = false; imgHeader.Visible = false; pnlPermission.Visible = true; pnlButtons.Visible = true; lblPermission.Text = String.Format(@"<b>警告:</b> {0} 账户对文件夹 {1} 没有完全控制权限,请对该文件夹配置这些权限。", System.Security.Principal.WindowsIdentity.GetCurrent().Name, dir); return; } } var filesToCheck = new List <string>(); filesToCheck.Add(rootDir + "ConnectionStrings.config"); filesToCheck.Add(rootDir + "web.config"); foreach (var file in filesToCheck) { if (!checkPermissions(file, false, true, true, true) && checkPermission) { pnlWizard.Visible = false; imgHeader.Visible = false; pnlPermission.Visible = true; pnlButtons.Visible = true; lblPermission.Text = String.Format(@"<b>警告:</b> {0} 账户对文件 {1} 没有完全控制权限,请对该文件配置这些权限。", System.Security.Principal.WindowsIdentity.GetCurrent().Name, file); return; } } if (testAgain) { pnlWizard.Visible = false; pnlPermission.Visible = false; pnlButtons.Visible = false; pnlPermissionSuccess.Visible = true; lblPermissionSuccess.Text = "完全控制权限已经配置成功!"; return; } } pnlWizard.Visible = true; pnlPermission.Visible = false; pnlButtons.Visible = false; if (!Page.IsPostBack) { var setData = Convert.ToBoolean(this.QueryStringInt("_sl", 0)); if (setData) { this.gvLsc_DataBind(); wzdInstaller.ActiveStepIndex = this.wzdInstaller.WizardSteps.IndexOf(this.stpLscSetting); } else { if (HttpContext.Current != null) { txtServerName.Text = WebUtility.GetServerIP(); txtHisServerName.Text = WebUtility.GetServerIP(); } this.TrustedConnection = false; this.HisTrustedConnection = false; wzdInstaller.ActiveStepIndex = 0; } } else { if (ViewState["install.password"] == null) { ViewState["install.password"] = this.txtPassword.Text; } } this.pnlLog.Visible = false; this.lblError.Text = String.Empty; mResult = String.Empty; }