Exemple #1
0
        /// <summary>
        /// CR119-08
        /// Save the contact and address objects extarcted from the card personaliztion object so it can be used later to populate tha anonymous user data
        /// </summary>
        public void SavePersonalizedContact()
        {
            OnlineAccountsManager lOnlineAccMgr = new OnlineAccountsManager();
            Contact lTargetContact = null;

            if (HttpContext.Current.Request.Cookies["PersonalizedContact"] != null)
            {
                //modified by Rabie @ 29 Oct 2013
                // decrypting "PersonalizedContact" cookie value as part of accepted work-around to "persistent cookie issue" in SND 4.0 security issues report
                var lPersonalizedContactID = EncryptionDecryptionManager.DecryptData(HttpContext.Current.Request.Cookies["PersonalizedContact"].Value
                                                                                     , URLLocalizationManager.PrivateKey);
                lTargetContact = lOnlineAccMgr.GetContact(int.Parse(lPersonalizedContactID), "Addresses");
                ConvertPersonalizationDataToContact(NavigationState.SB_Card.SB_CardPersonalizedInfo, lTargetContact);
                lOnlineAccMgr.UpdateContact(lTargetContact);
                lOnlineAccMgr.UpdateAddress(lTargetContact.Addresses.FirstOrDefault());
            }
            else
            {
                lTargetContact = new Contact();
                ConvertPersonalizationDataToContact(NavigationState.SB_Card.SB_CardPersonalizedInfo, lTargetContact);
                lOnlineAccMgr.CreateContact(lTargetContact);
            }
            //modified by Rabie @ 29 Oct 2013
            // encrypting/decrypting "PersonalizedContact" cookie value as accepted work-around to "persistent cookie issue" in SND 4.0 security issues report
            var lPersonalizedContactCookie = new HttpCookie("PersonalizedContact",
                                                            EncryptionDecryptionManager.EncryptData(lTargetContact.Contact_ID.ToString(), URLLocalizationManager.PublicKey));

            lPersonalizedContactCookie.Expires  = DateTime.Now.AddDays(1);
            lPersonalizedContactCookie.HttpOnly = true;
            lPersonalizedContactCookie.Secure   = true;
            HttpContext.Current.Response.Cookies.Add(lPersonalizedContactCookie);
        }