Example #1
0
        public void BindHeliconApe(WebSite site)
        {
            // save initial state
            this.IsSecuredFoldersInstalled = site.SecuredFoldersInstalled;
            this.HeliconApeStatus          = site.HeliconApeStatus;


            // Render a warning message about the automatic site's settings change
            if (site.IIs7)
            {
                if (!HeliconApeStatus.IsEnabled)
                {
                    // Ensure the message is displayed only when neccessary
                    if (site.EnableWindowsAuthentication || !site.AspNetInstalled.EndsWith("I") || site.SecuredFoldersInstalled)
                    {
                        // TODO: show warning, do not force to enable integrated pool
                        string warningStr = GetLocalizedString("EnableFoldersIIs7Warning.Text");
                        // Render a warning only if specified
                        if (!String.IsNullOrEmpty(warningStr))
                        {
                            btnToggleHeliconApe.OnClientClick = String.Format("return confirm('{0}')", warningStr);
                        }
                    }
                }
            }
            // toggle
            ToggleControls();
        }
Example #2
0
        protected void btnToggleHeliconApe_Click(object sender, EventArgs e)
        {
            try
            {
                int result = 0;
                if (HeliconApeStatus.IsEnabled)
                {
                    // uninstall folders
                    result = ES.Services.WebServers.DisableHeliconApe(PanelRequest.ItemID);
                }
                else
                {
                    // install folders
                    result = ES.Services.WebServers.EnableHeliconApe(PanelRequest.ItemID);
                }

                if (result < 0)
                {
                    HostModule.ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("WEB_INSTALL_HTACCESS", ex);
                return;
            }

            // change state
            HeliconApeStatus status = HeliconApeStatus;

            status.IsEnabled = !status.IsEnabled;

            HeliconApeStatus = status;

            // bind items
            ToggleControls();
        }