예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        if (Page.IsPostBack)
        {
            Response.Redirect("install.aspx?mode=db", true);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        apSettings.Load();
        UserName = apSettings.User;
        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        if (apSettings.Pass.Trim().Length > 0)
        {
            txtPassword.Attributes.Add("value", AdminPanelConstants.DummyPassword);
            txtPasswordConfirm.Attributes.Add("value", AdminPanelConstants.DummyPassword);
        }
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        if (Page.IsPostBack)
        {
            AdminPanelUtils.SaveState("AUTH", true, Page.Session);

            AdminPanelSettings apSettings = new AdminPanelSettings().Load();
            AdminPanelUtils.SaveState("Admin", apSettings.User, Page.Session);

            Response.Redirect("default.aspx", true);
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        controlPrefix = this.ClientID;

        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        intDbTypeMsSql_label.Attributes["for"]    = intDbTypeMsSql.ClientID;
        intDbTypeMySql_label.Attributes["for"]    = intDbTypeMySql.ClientID;
        intDbTypeMsAccess_label.Attributes["for"] = intDbTypeMsAccess.ClientID;

        WebmailSettings settings = new WebmailSettings().CreateInstance(AdminPanelUtils.GetWebMailDataFolder());

        if (Session["TrySqlPassword"] == null)
        {
            Session["TrySqlPassword"] = settings.DbPassword;
        }
        txtSqlPassword.Attributes.Add("Value", Session["TrySqlPassword"].ToString());

        switch (settings.DbType)
        {
        case SupportedDatabase.MsAccess:
            intDbTypeMsAccess.Checked = true;
            break;

        case SupportedDatabase.MsSqlServer:
            intDbTypeMsSql.Checked = true;
            break;

        case SupportedDatabase.MySql:
            intDbTypeMySql.Checked = true;
            break;
        }
        txtSqlLogin.Value          = settings.DbLogin;
        txtSqlName.Value           = settings.DbName;
        txtSqlDsn.Value            = settings.DbDsn;
        txtSqlSrc.Value            = settings.DbHost;
        txtAccessFile.Value        = settings.DbPathToMdb;
        odbcConnectionString.Value = settings.DbCustomConnectionString;
        useCS.Checked  = settings.UseCustomConnectionString;
        useDSN.Checked = settings.UseDSN;
        DbPrefix.Value = settings.DbPrefix;
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        object _EmptyKey = Session["EmptyKey"];

        if (_EmptyKey != null)
        {
            submit_btn.Attributes["onclick"] = "";
        }
        else
        {
            submit_btn1.Attributes["onclick"] = "window.open('http://www.afterlogic.com/congratulations/webmail-lite-net');";
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        AdminPanelSettings apSettings = new AdminPanelSettings().Load();

        if (Session["LicenseKey"] != null)
        {
            txtLicenseKey.Value = Session["LicenseKey"].ToString();
        }
        else
        {
            txtLicenseKey.Value = apSettings.LicenseKey;
        }

        _EmptyKey = Session["EmptyKey"];
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        install _page = Page as install;

        _web_step = _page._web_step;
        _max_step = _page._max_step;

        try
        {
            Session["TestCreateSessions"] = "1";
            _Sessions = @"<font color=""green"">OK</font>";
            var_sess  = "1";
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            _Sessions        = @"<font color=""red"">Error, session support in ASP.NET must be enabled</font>";
            _SessionsMessage = "<br/><br/>You need to enable session support in properties of WebMail and AdminPanel virtual directories / ASP.NET tab / Edit Configuration / State Management tab / Session State mode in your IIS Manager. Set it to any value, except Off. InProc is recommended value in most cases. Alternatively, you may manually enable session support in sessionState tag of web.config files in WebMail and AdminPanel folders. In case of a shared hosting, changing sessionState may have no effect if your ISP prohibited changing this parameter. You need to ask your hosting provider to enable session support in this case.";
            _Error           = true;
        }

        string DataFolderPath = AdminPanelUtils.GetWebMailDataFolder();

        if (DataFolderPath != null && Directory.Exists(DataFolderPath))
        {
            _DataFolderLocation = @"<font color=""green"">Found</font>";
            var_dfpath          = "1";
            try
            {
                string        temp_dir = Path.Combine(DataFolderPath, Path.GetRandomFileName());
                DirectoryInfo di       = Directory.CreateDirectory(temp_dir);
                di.Delete();
                _CreatingDeletingFolders = @"<font color=""green"">OK</font>";
                var_cdfolders            = "1";
            }
            catch (Exception)
            {
                _Error = true;
                _CreatingDeletingFolders = @"<font color=""red"">Creating/deleting folders Error, can't create or delete sub-folders in the data folder.</font>";


                _CreatingDeletingFoldersMessage = @"<br/><br/>You need to grant read/write permission over WebMail Lite data folder and all its contents to your web server user. For instructions, please refer to <a href=""docs/index-installation-instructions.htm"">this</a> section of WebMail Lite documentation and our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#3"" target=_blank>FAQ</a>.";
            }

            try
            {
                string     temp_file = Path.Combine(DataFolderPath, Path.GetRandomFileName());
                FileStream fs        = File.Create(temp_file);
                fs.Close();
                if (File.Exists(temp_file))
                {
                    File.Delete(temp_file);
                }
                _CreatingDeletingFiles = @"<font color=""green"">OK</font>";
                var_cdfiles            = "1";
            }
            catch (Exception)
            {
                _Error = true;
                _CreatingDeletingFiles = @"<font color=""red"">Creating/deleting files Error, can't create files in the data folder.</font>";


                _CreatingDeletingFilesMessage = @"<br/><br/>You need to grant read/write permission over WebMail Lite data folder and all its contents to your web server user. For instructions, please refer to <a href=""docs/index-installation-instructions.htm"">this</a> section of WebMail Lite documentation and our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#3"" target=_blank>FAQ</a>.";
            }

            if (File.Exists(Path.Combine(DataFolderPath, @"settings\adminpanel.xml")))
            {
                _AdminPanelSettingsFileLocation = @"<font color=""green"">Found</font>";
                var_apsfl = "1";

                try
                {
                    FileStream _fs2 = File.OpenRead(Path.Combine(DataFolderPath, @"settings\adminpanel.xml"));
                    _fs2.Close();
                    _AdminPanelReadSettingsFile = @"<font color=""green"">OK</font>";
                    var_apsfread = "1";
                }
                catch (Exception)
                {
                    _Error = true;
                    _AdminPanelReadSettingsFile = @"<font color=""red"">Error, can't read <nobr>""" + DataFolderPath + @"settings\adminpanel.xml" + @"""</nobr> file</font>";


                    _AdminPanelReadWriteSettingsFileMessage = @"<br/><br/>You should grant read/write permission over WebMail Lite admin panel settings file to your web server user. For instructions, please refer to <a href=""docs/index-installation-instructions.htm"">this</a> section of WebMail documentation and our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#3"" target=_blank>FAQ</a>.";
                }
                try
                {
                    FileStream _fs2 = File.OpenWrite(Path.Combine(DataFolderPath, @"settings\adminpanel.xml"));
                    _fs2.Close();
                    _AdminPanelWriteSettingsFile = @"<font color=""green"">OK</font>";
                    var_apsfwrite = "1";
                }
                catch (Exception)
                {
                    _Error = true;
                    _AdminPanelWriteSettingsFile = @"<font color=""red"">Error, can't write <nobr>""" + DataFolderPath + @"settings\adminpanel.xml" + @"""</nobr> file</font>";


                    _AdminPanelReadWriteSettingsFileMessage = @"<br/><br/>You should grant read/write permission over WebMail Lite admin panel settings file to your web server user. For instructions, please refer to <a href=""docs/index-installation-instructions.htm"">this</a> section of WebMail documentation and our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#3"" target=_blank>FAQ</a>.";
                }
            }
            else
            {
                _Error = true;
                _AdminPanelSettingsFileLocation = @"<font color=""red"">Not Found, can't find <nobr>""" + DataFolderPath + @"settings\adminpanel.xml""</nobr> file.</font>";

                tr_AdminPanelReadSettingsFile.Attributes["class"] = "wm_hide";



                _AdminPanelSettingsFileLocationMessage = @"<br/><br/>Make sure you completely copied the data folder with all its contents from WebMail Lite installation package into the location you specified in web.config file.";

                _AdminPanelSettingsFileLocationStyle = "border:1px solid #ff0000";
            }

            if (File.Exists(Path.Combine(DataFolderPath, @"settings\settings.xml")))
            {
                _WebMailSettingsFileLocation = @"<font color=""green"">Found</font>";
                var_wmsfl = "1";

                try
                {
                    FileStream _fs1 = File.OpenRead(Path.Combine(DataFolderPath, @"settings\settings.xml"));
                    _fs1.Close();
                    _WebMailReadSettingsFile = @"<font color=""green"">OK</font>";
                    var_wmsfread             = "1";
                }
                catch (Exception)
                {
                    _Error = true;
                    _WebMailReadSettingsFile = @"<font color=""red"">Error, can't read <nobr>""" + DataFolderPath + @"settings\settings.xml" + @"""</nobr> file</font>";


                    _WebMailReadWriteSettingsFileMessage = @"<br/><br/>You should grant read/write permission over WebMail Lite settings file to your web server user. For instructions, please refer to <a href=""docs/index-installation-instructions.htm"">this</a> section of WebMail documentation and our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#3"" target=_blank>FAQ</a>.";
                }

                try
                {
                    FileStream _fs1 = File.OpenWrite(Path.Combine(DataFolderPath, @"settings\settings.xml"));
                    _fs1.Close();
                    _WebMailWriteSettingsFile = @"<font color=""green"">OK</font>";
                    var_wmsfwrite             = "1";
                }
                catch (Exception)
                {
                    _Error = true;
                    _WebMailWriteSettingsFile = @"<font color=""red"">Error, can't write <nobr>""" + DataFolderPath + @"settings\settings.xml" + @"""</nobr> file</font>";


                    _WebMailReadWriteSettingsFileMessage = @"<br/><br/>You should grant read/write permission over WebMail Lite settings file to your web server user. For instructions, please refer to <a href=""docs/index-installation-instructions.htm"">this</a> section of WebMail documentation and our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#3"" target=_blank>FAQ</a>.";
                }
            }
            else
            {
                _Error = true;
                _WebMailSettingsFileLocation = @"<font color=""red"">Not Found, can't find <nobr>""" + DataFolderPath + @"settings\settings.xml""</nobr> file.</font>";

                tr_WebMailReadSettingsFile.Attributes["class"] = "wm_hide";



                _WebMailSettingsFileLocationMessage = @"<br/><br/>Make sure you completely copied the data folder with all its contents from WebMail Lite installation package into the location you specified in web.config file.";

                _WebMailSettingsFileLocationStyle = "border:1px solid #ff0000";
            }
        }
        else
        {
            _Error = true;

            _DataFolderLocation = @"<font color=""red"">Not Found, can't find <nobr>""" + DataFolderPath + @"""</nobr> folder.</font>";



            _DataFolderLocationMessage = @"<br/><br/>You need to specify correct path to the data folder in web.config file (resides in web folder of WebMail Lite). You can learn more from our <a href=""http://www.afterlogic.com/support/faq-webmail-lite-asp-net#2"" target=_blank>FAQ</a>";

            _DataFolderLocationStyle = "border:1px solid #ff0000";

            tr_AdminPanelReadSettingsFile.Attributes["class"]     = "wm_hide";
            tr_AdminPanelSettingsFileLocation.Attributes["class"] = "wm_hide";
            tr_WebMailReadSettingsFile.Attributes["class"]        = "wm_hide";
            tr_WebMailSettingsFileLocation.Attributes["class"]    = "wm_hide";
            tr_CreatingDeletingFiles.Attributes["class"]          = "wm_hide";
            tr_CreatingDeletingFolders.Attributes["class"]        = "wm_hide";
        }

        try
        {
            Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            s.ReceiveTimeout = 1;
            s.Connect("localhost", 80);
            _Sockets    = @"<font color=""green"">OK</font>";
            var_sockets = "1";
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            if (error is System.Security.SecurityException)
            {
                _Sockets        = @"<font color=""red"">No SocketPermission</font>";
                _SocketsMessage = "<br/>This means using sockets is prohibited. You should increase \"trust level\" in your ASP.NET configuration to \"Hight Trust\" or \"Full Trust\" or customize the current \"trust level\" to enable SocketPermission.<br/>To learn more, please refer to <a href=\"http://www.afterlogic.com/kb/articles/webmail-pro-aspnet-no-socketpermission-or-no-odbcpermission-errors-and-medium-trust-policy\" target=_blank>this</a> KB article.";
                _Error          = true;
            }
            else
            {
                _Sockets    = @"<font color=""green"">OK</font>";
                var_sockets = "1";
            }
        }

        try
        {
            OdbcConnection odbc1 = new OdbcConnection();
            odbc1.ConnectionTimeout = 1;
            odbc1.ConnectionString  = @"Driver=MySQL ODBC 3.51 Driver;Server=localhost;Port=3306;Database=webmail;User=user;Password=pass;Option=3;";
            odbc1.Open();
            _ODBC    = @"<font color=""green"">OK</font>";
            var_odbc = "1";
        }
        catch (Exception error)
        {
            Log.WriteException(error);
            if (error is System.Security.SecurityException)
            {
                _ODBC        = @"<font color=""red"">No OdbcPermission</font>";
                _ODBCMessage = "<br/>This means using ODBC driver is not allowed. You should increase \"trust level\" in your ASP.NET configuration to \"Hight Trust\" or \"Full Trust\" or customize the current \"trust level\" to enable OdbcPermission.<br/>To learn more, please refer to <a href=\"http://www.afterlogic.com/kb/articles/webmail-pro-aspnet-no-socketpermission-or-no-odbcpermission-errors-and-medium-trust-policy\" target=_blank>this</a> KB article.";
                _Error       = true;
            }
            else
            {
                _ODBC    = @"<font color=""green"">OK</font>";
                var_odbc = "1";
            }
        }

        if (_Error)
        {
            btnCheckName    = "Retry";
            btnCheckOnClick = "document.location='install.aspx?mode=check'";
            _divResult.Attributes["class"] = "wm_install_last_div_error";
            _ResultMessage = "Please make sure that all the requirements are met and click Retry.";
        }
        else
        {
            btnCheckName    = "Next";
            btnCheckOnClick = "document.location='install.aspx?mode=license'";
            _divResult.Attributes["class"] = "wm_install_last_div_ok";
            _ResultMessage = "The current server environment meets all the requirements. Click Next to proceed.";
        }

        var_str = "&var_sess=" + var_sess +
                  "&var_dfpath=" + var_dfpath +
                  "&var_cdfolders=" + var_cdfolders +
                  "&var_cdfiles=" + var_cdfiles +
                  "&var_apsfl=" + var_apsfl +
                  "&var_apsfread=" + var_apsfread +
                  "&var_apsfwrite=" + var_apsfwrite +
                  "&var_wmsfl=" + var_wmsfl +
                  "&var_wmsfread=" + var_wmsfread +
                  "&var_wmsfwrite=" + var_wmsfwrite +
                  "&var_sockets=" + var_sockets +
                  "&var_odbc=" + var_odbc;

        if (Session["EmptyKey"] == null)
        {
            _page.check_str = var_str;
        }
    }