protected void saveUserInfo(Dictionary<string, string> formInfo) { saveErr = ""; try { mySqlConnector mySqlConn = new mySqlConnector(); if (mySqlConn.isInitialized() && mySqlConn.registerUser(formInfo)) { saveErr = mySqlConn.login(Email.Text, Password.Text) ? "" : mySqlConn.connErrMsg; if (saveErr != "") { displayFormErrors(); mySqlConn.deInitialize(); } else { //write session out for sng Session["emailAddress"] = Email.Text; Session["firstName"] = FirstName.Text; Session["lastName"] = LastName.Text; Session["isLoggedIn"] = true; Session["userId"] = mySqlConn.UserObj.UserId; //push user to success page and consignment agreement mySqlConn.deInitialize(); Response.Redirect("RegisterSuccess.aspx"); } } else { if (mySqlConn.connErrMsg == "already registered") { saveErr = "Email Address already registered."; } else { //TODO: refactor this code to produce a more specific error that can be reported?? saveErr = mySqlConn.connErrMsg; } displayFormErrors(); } } catch (Exception ee) { saveErr = ee.Message.ToString(); displayFormErrors(); } }