Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //do a quick test.  If the database connects, inform the user the database seems to be working.
            DatabaseUtilities du = new DatabaseUtilities(Server);
            string msg = du.TestDatabaseConnection();
            if (msg == null)
            {
                lblOutput.Text = "You appear to be connected to a valid MySQL Database.  If you want to reconfigure or rebuild the database, click on the button below!";
                Session["DBConfigured"] = true;
            }
            else
            {
                lblOutput.Text = "Before proceeding, please ensure this instance of WebGoat.NET can connect to the database!";
                //PanelError.Visible = true;
            }

        }
Esempio n. 2
-1
        protected void btnTestConfiguration_Click(object sender, EventArgs e)
        {
            //get all the fields, save in conf file
            //use that to then connect to the database
            
            IOHelper iohelper = new IOHelper(Server);
            
            string result = iohelper.SaveDBConfigString(txtServer.Text, txtPort.Text, txtDatabase.Text, txtUserName.Text, txtPassword.Text);

            if (result != null)
                lblOutput.Text = result;
            else
            {
                DatabaseUtilities du = new DatabaseUtilities(Server);
                string msg = du.TestDatabaseConnection();
                if (msg == null)
                {
                    labelSuccess.Text = "Connection to Database Successful!";
                    PanelSuccess.Visible = true;
                    Session["DBConfigured"] = true;
                }
                else
                {
                    labelError.Text = msg;
                    PanelError.Visible = true;
                    Session["DBConfigured"] = null;
                }
            }
        }