protected void Page_Load(object sender, EventArgs e) { Session["bodyid"] = "user-home"; if (Session != null) { // Store essential session information temporarily string culture = Session["culture"] as string ?? "nl-NL"; Session.Clear(); FormsAuthentication.SignOut(); // Restore the essential session information Session["culture"] = culture; } if (Request.IsAuthenticated) { if (Request.Params["pid"] != null || Request.Params["tid"] != null) { Response.Redirect(string.Format("~/Account/Login.aspx?tid={0}&pid={1}", Request.Params["tid"], Request.Params["pid"]), false); } else { Response.Redirect("~/Default.aspx", false); } } Literal name = HeadLoginView.FindControl("HeadLoginName") as Literal; if (name != null) { if (Session["userid"] != null) { long userId = Util.UserId; using (Database db = new MySqlDatabase()) { ClientInfo ci = db.GetClientInfo(userId); name.Text = string.Format(" {0}", ci.GetFullName()); } } } SetStringForWizardLabel("PasswordLengthLabel", string.Format(Resources.Resource.NewPasswordReq, Membership.MinRequiredPasswordLength)); RegisterUser.ContinueDestinationPageUrl = REGISTER_CONTINUATION_PAGE; if (!string.IsNullOrEmpty(Request.Params["pid"])) { Session["register.pid"] = Request.Params["pid"]; Session["register.country"] = Request.Params["country"]; Session["register.price"] = Request.Params["price"]; } if (Session["register.pid"] != null) { string destinationPage = "BuyProduct"; decimal price = 0m; if (!decimal.TryParse(Session["register.price"] as string, out price)) price = 0m; if (price == 0m) { destinationPage = "Quotation"; } else { int prodid; if (!int.TryParse(Request.Params["pid"], out prodid)) prodid = 0; if (prodid > 0) { using (Database db = new MySqlDatabase()) { ProductInfo prodInfo = db.GetProductById(prodid); if (System.String.Compare(prodInfo.Extra, "subscription", System.StringComparison.OrdinalIgnoreCase) == 0) destinationPage = "Subscription"; } } } RegisterUser.ContinueDestinationPageUrl = string.Format("~/Member/{0}.aspx?pid={1}&country={2}&price={3}", destinationPage, Session["register.pid"], Session["register.country"], Session["register.price"]); } if (!string.IsNullOrEmpty(Request.Params["id"])) { Session["register.confirm.id"] = Request.Params["id"]; Session["register.confirm.tp"] = Request.Params["tp"]; RegisterUser.ContinueDestinationPageUrl = REGISTER_CONTINUATION_PAGE; // string.Format("~/Member/Confirm.aspx?id={0}&tp={1}", Request.Params["id"], Request.Params["tp"]); } if (!IsPostBack) { int pid = 0; if (Request.Params["pid"] != null) { string tmp = Request.Params["pid"]; if (!string.IsNullOrEmpty(tmp)) { int iTmp; if (int.TryParse(tmp, out iTmp)) pid = iTmp; } } if (Request.Params["mode"] != null) { string tmp = Request.Params["mode"]; if (!string.IsNullOrEmpty(tmp)) { if (tmp.ToLower() == "edit") { TextBox userName = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("UserName") as TextBox; if (userName != null) userName.ReadOnly = true; } } } if (Request.Params["res"] != null) { string res = Request.Params["res"]; if (!string.IsNullOrEmpty(res)) { string errorMsg = Resources.Resource.SecurityCodeIncorrect; if (Session["errmsg"] != null) errorMsg = Session["errmsg"] as string; Literal ErrorMessage = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("ErrorMessage") as Literal; if (ErrorMessage != null) ErrorMessage.Text = string.Format(Resources.Resource.ErrorMessageFmt, errorMsg); } } if (Request.QueryString["ErrorId"] == "alreadyexist") { Response.Redirect("~/ThankYou.aspx?id=1"); } else if (Request.QueryString["ErrorId"] == "error") { Response.Redirect("~/ThankYou.aspx?id=2"); } else if (Request.QueryString["ErrorId"] == "cancel") { Response.Redirect("~/ThankYou.aspx?id=4"); } else if (Request.QueryString["ErrorId"] == "success") { string email = Request.QueryString["email"]; string firstName = Request.QueryString["first_name"]; string lastName = Request.QueryString["last_name"]; RegisterUser.UserName = Guid.NewGuid().ToString(); ViewState["pwd"] = GeneratePassword(); using (Database db = new MySqlDatabase()) {//Added by Nagesh to remove duplicate emails, Also removed email send function from db.registeruser, email should be sent from here only Util.UserId = db.RegisterUser(RegisterUser.UserName, "/", email, "", Convert.ToString(ViewState["pwd"]), null, null, 0); } RegisterClientInfoUsingFBCredentials(firstName, lastName, email, Convert.ToString(ViewState["pwd"])); Response.Redirect("~/ThankYou.aspx"); } else if (Request.QueryString["id"] != null && Request.QueryString["tp"] != null && Request.QueryString["requestingUserinfo"] != null) { string id = Request.QueryString["id"]; string relationType = Request.QueryString["tp"]; string fullName = string.Empty; try { fullName = EncryptionClass.Decrypt(Request.QueryString["requestingUserinfo"]); } catch { } if (!string.IsNullOrEmpty(fullName)) { TextBox FirstName = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("FirstName") as TextBox; FirstName.Text = fullName.Split(' ')[0]; TextBox LastName = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("LastName") as TextBox; LastName.Text = fullName.Split(' ')[1]; } string requestedEmail = string.Empty; using (Database db = new MySqlDatabase()) { db.getEmailByUniqueId(id, out requestedEmail); } string UserEmail = requestedEmail; TextBox Email = RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("Email") as TextBox; Email.Text = UserEmail; } } IncludePage(FooterLiteral, Resources.Resource.FooterSection); if (Convert.ToString(Session["culture"]).Contains("nl")) { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "LanguageNL" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "LanguageUS" + "');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "LanguageUS" + "');", true); ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "LanguageNL" + "');", true); } }