//*******************************************************
        //
        // The LoginBtn_Click event is used on this page to
        // authenticate a customer's supplied username/password
        // credentials against a database.
        //
        // If the supplied username/password are valid, then
        // the event handler adds a cookie to the client
        // (so that we can personalize the home page's welcome
        // message), migrates any items stored in the user's
        // temporary (non-persistent) shopping cart to their
        // permanent customer account, and then redirects the browser
        // back to the originating page.
        //
        //*******************************************************
        private void LoginBtn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            // Only attempt a login if all form fields on the page are valid
            if (Page.IsValid == true) {

                // Save old ShoppingCartID
                AWC.BusinessLayer.ShoppingCart shoppingCart = new AWC.BusinessLayer.ShoppingCart();
                String tempCartID = shoppingCart.GetShoppingCartId();

                // Attempt to Validate User Credentials using CustomersDB
                AWC.BusinessLayer.Customers accountSystem = new AWC.BusinessLayer.Customers();
                String customerId = accountSystem.Login(email.Text, AWC.BusinessLayer.Security.Encrypt(password.Text));

                if (customerId != null) {

                    // Migrate any existing shopping cart items into the permanent shopping cart
                    shoppingCart.MigrateCart(tempCartID, customerId);

                    // Lookup the customer's full account details
                    AWC.Entities.Customer customerDetails = accountSystem.GetCustomerDetails(customerId);

                    // Store the user's fullname in a cookie for personalization purposes
                    Response.Cookies["ASPNETCommerce_FullName"].Value = customerDetails.FullName;

                    // Make the cookie persistent only if the user selects "persistent" login checkbox
                    if (RememberLogin.Checked == true) {
                        Response.Cookies["ASPNETCommerce_FullName"].Expires = DateTime.Now.AddMonths(1);
                    }

                    // Redirect browser back to originating page
                    FormsAuthentication.RedirectFromLoginPage(customerId, RememberLogin.Checked);
                }
                else {
                    Message.Text = "Login Failed!";
                }
            }
        }
        //*******************************************************
        //
        // The RegisterBtn_Click event handler is used on this page to
        // add a new user into the Commerce Starter Kit Customers database.
        //
        // The event handler then migrates any items stored in the user's
        // temporary (non-persistent) shopping cart to their
        // permanent customer account, adds a cookie to the client
        // (so that we can personalize the home page's welcome
        // message), and then redirects the browser back to the
        // originating page.
        //
        //*******************************************************
        private void RegisterBtn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            // Only attempt a login if all form fields on the page are valid
            if (Page.IsValid == true) {

                // Store off old temporary shopping cart ID
                AWC.BusinessLayer.ShoppingCart shoppingCart = new AWC.BusinessLayer.ShoppingCart();
                String tempCartId = shoppingCart.GetShoppingCartId();

                // Add New Customer to CustomerDB database
                AWC.BusinessLayer.Customers accountSystem = new AWC.BusinessLayer.Customers();
                String customerId = accountSystem.AddCustomer(Name.Text, Email.Text, AWC.BusinessLayer.Security.Encrypt(Password.Text));

            if (customerId != "") {

                // Set the user's authentication name to the customerId
                FormsAuthentication.SetAuthCookie(customerId, false);

                // Migrate any existing shopping cart items into the permanent shopping cart
                shoppingCart.MigrateCart(tempCartId, customerId);

                // Store the user's fullname in a cookie for personalization purposes
                Response.Cookies["ASPNETCommerce_FullName"].Value = Server.HtmlEncode(Name.Text);

                // Redirect browser back to shopping cart page
                Response.Redirect("ShoppingCart.aspx");
                }
                else {
                    MyError.Text = "Registration failed:&nbsp; That email address is already registered.<br><img align=left height=1 width=92 src=images/1x1.gif>";
                }
            }
        }