//We haave to set up a method so that when the user clicks submit, the information goes into the database and into the "Manage Pages" page.
        //We set up connection to the PagesDB and SET the information into the values.
        protected void Add_Page(object sender, EventArgs e)
        {
            PagesDB db = new PagesDB();


            HTTP_Page new_page = new HTTP_Page();


            new_page.SetPagetitle(newpage_title.Text);
            new_page.SetPagebody(newpage_body.Text);
            new_page.SetPageauthor(newpage_author.Text);
            new_page.SetTimeStamp(DateTime.Now);


            db.AddPage(new_page);


            Response.Redirect("ManagePages.aspx");
        }
        // We create another method for when a user wants to view a page that is already in the database.
        public HTTP_Page FindPage(int id)
        {
            MySqlConnection Connect = new MySqlConnection(ConnectionString);

            HTTP_Page result_page = new HTTP_Page();


            try
            {
                //Again we write a query specific to finding pages depending on the id number by connecting it to the database
                string query = "select * from pagesmgmt where pageid =" + id;

                Debug.WriteLine("Connection Initialized...");

                Connect.Open();

                MySqlCommand cmd = new MySqlCommand(query, Connect);

                MySqlDataReader resultset = cmd.ExecuteReader();


                List <HTTP_Page> pages = new List <HTTP_Page>();

                while (resultset.Read())
                {
                    HTTP_Page currentpage = new HTTP_Page();


                    for (int i = 0; i < resultset.FieldCount; i++)
                    {
                        string key   = resultset.GetName(i);
                        string value = resultset.GetString(i);
                        Debug.WriteLine("Attempting to transfer " + key + " data of " + value);
                        // We make sure to write the correct variables so that the information matches
                        switch (key)
                        {
                        case "pagetitle":
                            currentpage.SetPagetitle(value);
                            break;

                        case "pagebody":
                            currentpage.SetPagebody(value);
                            break;

                        case "pageauthor":
                            currentpage.SetPageauthor(value);
                            break;

                        case "timestamp":
                            currentpage.SetTimeStamp(DateTime.Parse(value));
                            //we have to get the time that the databas automatically created
                            break;
                        }
                    }

                    pages.Add(currentpage);
                }

                result_page = pages[0];
            }
            catch (Exception ex)
            {
                //We create debugs so that if something goes wrong we know on what part it was
                Debug.WriteLine("Something went wrong in the find Page method!");
                Debug.WriteLine(ex.ToString());
            }

            Connect.Close();
            Debug.WriteLine("Database Connection Terminated.");

            return(result_page);
        }