public string CreateUser(string txtUsername, string txtPassword) { bool userAddError = false; string message = ""; //try catch block add user try { //call datalayer class insertcustomer method myDataLayer.AddUser(txtUsername, txtPassword); } catch (Exception error) { //set error to true and update feedback text message userAddError = true; message = "Error adding customer, please check form data. " + error.Message; return(message); } if (!userAddError) { HttpContext.Current.Session["username"] = txtUsername; HttpContext.Current.Session["password"] = txtPassword; HttpContext.Current.Response.Redirect("Account Details Confirmation.aspx"); } return(message); }