Esempio n. 1
0
 public static Dictionary <String, List <AssetServerAsset> > GetAssetServerAssets()
 {
     try
     {
         Dictionary <String, List <AssetServerAsset> > ret = new Dictionary <String, List <AssetServerAsset> >();
         String rssXML = CommonLogic.AspHTTP(AssetServerURL, 5);
         if (rssXML.Contains("<html"))
         {
             throw new InvalidOperationException("The license server feed was invalid.");
         }
         XmlDocument rssDoc = new XmlDocument();
         rssDoc.LoadXml(rssXML);
         XmlNodeList items = rssDoc.SelectNodes("//item");
         XmlDocument item  = new XmlDocument();
         for (int i = 0; i < items.Count; i++)
         {
             item.LoadXml(items[i].OuterXml);
             AssetServerAsset newItem = new AssetServerAsset(item);
             if (!ret.ContainsKey(newItem.Description.Replace(" ", "")))
             {
                 ret.Add(newItem.Description.Replace(" ", ""), new List <AssetServerAsset>());
             }
             ret[newItem.Description.Replace(" ", "")].Add(newItem);
         }
         return(ret);
     }
     catch
     {
         return(new Dictionary <String, List <AssetServerAsset> >());
     }
 }
Esempio n. 2
0
        private void Render()
        {
            StringBuilder writer = new StringBuilder();

            if (ThisCustomer.IsAdminSuperUser)
            {
                if (CommonLogic.QueryStringCanBeDangerousContent("set").ToUpper(CultureInfo.InvariantCulture) == "TRUE")
                {
                    bool   OkToUseSSL        = false;
                    String WorkerWindowInSSL = String.Empty;
                    String TestSSLUrl        = AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm";
                    writer.Append("Testing URL: " + TestSSLUrl + "...<br/>");
                    try
                    {
                        WorkerWindowInSSL = CommonLogic.AspHTTP(TestSSLUrl, 30);
                    }
                    catch (Exception ex)
                    {
                        writer.Append("Failed: " + CommonLogic.GetExceptionDetail(ex, "<br/>") + "<br/>");
                    }
                    writer.Append("Worker Window Contents: <textarea rows=\"10\" cols=\"60\">" + WorkerWindowInSSL + "</textarea><br/>");
                    if (WorkerWindowInSSL.IndexOf("Worker") != -1)
                    {
                        OkToUseSSL = true;
                    }
                    if (OkToUseSSL)
                    {
                        AppLogic.SetAppConfig("UseSSL", "true");
                        writer.Append("SSL ON");
                    }
                    else
                    {
                        AppLogic.SetAppConfig("UseSSL", "false");
                        writer.Append("<font color=\"red\"><b>No SSL certificate was found on your site. Please check with your hosting company! You must be able to invoke your store site using https:// before turning SSL on in this admin site!</b></font>");
                    }
                }
                else
                {
                    AppLogic.SetAppConfig("UseSSL", "false");
                    writer.Append("SSL OFF");
                }
            }
            ltContent.Text = writer.ToString();
        }
Esempio n. 3
0
        protected override void OnPreInit(EventArgs e)
        {
            if (HttpContext.Current != null)
            {
                m_ThisCustomer = ((InterpriseSuiteEcommercePrincipal)Context.User).ThisCustomer;

                if (AppLogic.AppConfigBool("GoogleCheckout.ShowOnCartPage"))
                {
                    string s = CachingFactory.ApplicationCachingEngineInstance.GetItem <string>(DomainConstants.GCCallbackLoadCheck);
                    if (s != null)
                    {
                        string notused = CommonLogic.AspHTTP(AppLogic.GetStoreHTTPLocation(false) + "gccallback.aspx?loadcheck=1", 10);
                        CachingFactory.ApplicationCachingEngineInstance.AddItem(DomainConstants.GCCallbackLoadCheck, "true", 5);
                    }
                }

                if (!CurrentContext.IsInAdminRoot() &&
                    (AppLogic.AppConfigBool("SiteDisclaimerRequired") &&
                     CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).IsNullOrEmptyTrimmed()))
                {
                    string ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING");
                    Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL));
                }

                Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(ThisCustomer.LocaleSetting);
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting);
                LoadSkinTemplate();
                m_Parser = new Parser(m_EntityHelpers, m_SkinID, m_ThisCustomer);
                m_Parser.RenderHeader += this.OnRenderHeader;

                if (this.HasControls())
                {
                    foreach (Control c in this.Controls)
                    {
                        FindLocaleStrings(c);
                    }

                    Control ctl;
                    int     i         = 1;
                    int     limitLoop = 1000;
                    if (m_Template != null && m_Template.Content != null)
                    {
                        while (this.Controls.Count > 0 && i <= limitLoop)
                        {
                            bool FilterItOut = false;
                            ctl = this.Controls[0];
                            LiteralControl l = ctl as LiteralControl;
                            if (l != null)
                            {
                                string txtVal = l.Text;
                                if (txtVal.IndexOf("<html", StringComparison.InvariantCultureIgnoreCase) != -1 ||
                                    txtVal.IndexOf("</html", StringComparison.InvariantCultureIgnoreCase) != -1)
                                {
                                    FilterItOut = true; // remove outer html/body crap, as we're going to be moving the page controls INSIDE The skin
                                }
                            }
                            if (!FilterItOut)
                            {
                                // reparent the page control to be moved inside the skin template user control
                                m_Template.Content.Controls.Add(ctl);
                            }
                            else
                            {
                                this.Controls.RemoveAt(0);
                            }
                            i++;
                        }
                    }

                    // clear the controls (they were now all moved inside the template user control:
                    this.Controls.Clear();
                    // set the template user control to be owned by this page:
                    this.Controls.Add(m_Template);

                    //register the ScriptManager before loading controls or the ComponentArt menu won't work with AJAX pages
                    CheckIfRequireScriptManager();

                    // Now move the template child controls up to the page level so the ViewState will load
                    while (m_Template.Controls.Count > 0)
                    {
                        this.Controls.Add(m_Template.Controls[0]);
                    }
                }

                if (AppLogic.IsCBNMode() && m_ThisCustomer != null)
                {
                    var cart = new ShoppingCart(m_ThisCustomer.SkinID, m_ThisCustomer, CartTypeEnum.ShoppingCart, string.Empty, false);
                    if (!cart.IsEmpty())
                    {
                        //empty shopping cart
                        cart.ClearContents();
                    }
                }

                string bingAdsTrackingScript = AppLogic.GetBingAdsTrackingScript();

                if (!bingAdsTrackingScript.IsNullOrEmptyTrimmed())
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), DB.GetNewGUID(), bingAdsTrackingScript, false);
                }
            }

            base.OnPreInit(e);
        }
Esempio n. 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            bool BadSSL = false;

            // save the config settings:
            AtomStoreZip.Save();
            AtomLiveServer.Save();

            StringBuilder errors = new StringBuilder();

            if (AppLogic.TrustLevel == AspNetHostingPermissionLevel.Unrestricted)
            {
                WebConfigManager webMgr = new WebConfigManager();
                if (webMgr.ProtectWebConfig != rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase) || rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                {
                    webMgr.ProtectWebConfig = rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);

                    if (rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        webMgr.SetMachineKey          = true;
                        webMgr.ValidationKeyGenMethod = WebConfigManager.KeyGenerationMethod.Auto;
                        webMgr.DecryptKeyGenMethod    = WebConfigManager.KeyGenerationMethod.Auto;
                    }

                    List <Exception> saveWebConfigExceptions = webMgr.Commit();

                    WebConfigManager webMgrNew = new WebConfigManager();

                    if (saveWebConfigExceptions.Count > 0 && (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig || rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true")))
                    {
                        if (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig)
                        {
                            errors.Append("Your web config encryption could not be changed due to the following error(s): <br />");
                        }
                        if (rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true"))
                        {
                            errors.Append("Could not set static machine key due to the following error(s): <br />");
                        }
                        foreach (Exception ex in saveWebConfigExceptions)
                        {
                            errors.Append(ex.Message + "<br />");
                        }
                    }
                }
            }

            if (AtomStoreUseSSL.GetValue(AppLogic.StoreID()).ToBool() || AtomStoreUseSSL.GetValue(0).ToBool())
            {
                BadSSL = true;
                String        WorkerWindowInSSL = String.Empty;
                List <string> urlsToTry         = new List <string>();
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm");
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://").Replace("https://", "https://www.") + "empty.htm");

                foreach (String urlToTry in urlsToTry)
                {
                    if (BadSSL)
                    {
                        try
                        {
                            WorkerWindowInSSL = CommonLogic.AspHTTP(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm", 10);
                        }
                        catch { }

                        if (WorkerWindowInSSL.IndexOf("Worker") != -1)
                        {
                            AtomStoreUseSSL.Save();
                            BadSSL = false;
                            break;
                        }
                    }
                }
            }
            else
            {
                AtomStoreUseSSL.Save();
            }

            AtomLiveServer.Save();
            AtomStoreCurrency.Save();
            AtomStoreCurrencyNumeric.Save();
            AtomStoreName.Save();
            AtomStoreLiveTransactions.Save();

            string temp = GetCheckedPaymentMethods();

            AppConfig config = AppLogic.GetAppConfig(0, "UseSSL");

            config = AppLogic.GetAppConfig(0, "PaymentMethods");
            if (config != null)
            {
                if (temp.Length > 0)
                {
                    config.ConfigValue = temp;
                }
                else
                {
                    config.ConfigValue = string.Empty;
                }
            }

            config = AppLogic.GetAppConfig(0, "Micropay.Enabled");
            if (config != null)
            {
                if (temp.IndexOf(AppLogic.ro_PMMicropay, StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    config.ConfigValue = "true"; // preserve setting of obsolete appconfig
                }
                else
                {
                    config.ConfigValue = "false"; // preserve setting of obsolete appconfig
                }
            }

            config = AppLogic.GetAppConfig(0, "PaymentGateway");
            if (config != null)
            {
                string newGateway        = getSelectedGateway();
                string newGatewayProduct = getSelectedGatewayProduct();

                if (!String.IsNullOrEmpty(newGateway))
                {
                    config.ConfigValue = newGateway;
                }

                if (newGateway == "PayFlowPro")
                {
                    var payFlowProProduct = AppLogic.GetAppConfig(0, "PayFlowPro.Product");
                    payFlowProProduct.ConfigValue = newGatewayProduct;

                    // If PPA Gateway is selected, then set the PPA Method
                    if (newGatewayProduct == "PayPal Payments Advanced")
                    {
                        if (!temp.Contains("PayPalEmbeddedCheckout"))
                        {
                            var ppaConfig = AppLogic.GetAppConfig(0, "PaymentMethods");
                            ppaConfig.ConfigValue += ", PayPalEmbeddedCheckout";
                        }
                    }

                    // if any PayFlow gateway is selected, select PayPalExpress
                    if (!temp.Contains("PayPalExpress"))
                    {
                        var ppeConfig = AppLogic.GetAppConfig(0, "PaymentMethods");
                        ppeConfig.ConfigValue   += ", PayPalExpress";
                        cbxPayPalExpress.Checked = true;
                    }
                }
            }

            if ("WIZARD".Equals(AppLogic.AppConfig("OrderShowCCPwd", 0, false), StringComparison.InvariantCultureIgnoreCase))
            {
                config = AppLogic.GetAppConfig(0, "OrderShowCCPwd");
                if (config != null)
                {
                    config.ConfigValue = CommonLogic.GetRandomNumber(1000, 1000000).ToString() + CommonLogic.GetRandomNumber(1000, 1000000).ToString() + CommonLogic.GetRandomNumber(1000, 1000000).ToString();
                }
            }

            string BuySafeMessage = string.Empty;

            if (rblBuySafeEnabled.SelectedIndex == 1)
            {
                BuySafeRegistrationStatus bss = BuySafeController.BuySafeOneClickSignup();
                if (!bss.Sucessful)
                {
                    BuySafeMessage = "<br/><b style=\"color:red;\">buySAFE could not be enabled.{0}";
                    errors.Append(string.Format(BuySafeMessage, (string.IsNullOrEmpty(bss.ErrorMessage) ? "" : " Error message: " + bss.ErrorMessage)));
                }
            }

            if (BadSSL)
            {
                errors.Append("No SSL certificate was found on your site. Please check with your hosting company! You must be able to invoke your store site using https:// before turning SSL on in this admin site!<br />");
            }

            if (errors.ToString().Length > 0)
            {
                resetError(errors.ToString(), true);
            }
            else
            {
                resetError("Configuration Wizard completed successfully.", false);
            }

            loadData();
        }
Esempio n. 5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            var BadSSL = false;

            // save the config settings:
            AtomStoreZip.Save();
            AtomLiveServer.Save();

            if (AtomStoreUseSSL.GetValue(AppLogic.StoreID()).ToBool() || AtomStoreUseSSL.GetValue(0).ToBool())
            {
                BadSSL = true;
                var WorkerWindowInSSL = string.Empty;
                var urlsToTry         = new List <string>();
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://") + "empty.htm");
                urlsToTry.Add(AppLogic.GetStoreHTTPLocation(false).Replace("http://", "https://").Replace("https://", "https://www.") + "empty.htm");

                foreach (var urlToTry in urlsToTry)
                {
                    if (BadSSL)
                    {
                        WorkerWindowInSSL = CommonLogic.AspHTTP(urlToTry, 10);

                        if (!string.IsNullOrEmpty(WorkerWindowInSSL) && WorkerWindowInSSL.IndexOf("Worker") != -1)
                        {
                            AtomStoreUseSSL.Save();
                            BadSSL = false;
                            break;
                        }
                    }
                }
            }
            else
            {
                AtomStoreUseSSL.Save();
            }

            AtomLiveServer.Save();
            AtomStoreCurrency.Save();
            AtomStoreCurrencyNumeric.Save();
            AtomStoreName.Save();
            AtomStoreLiveTransactions.Save();

            var checkedPaymentMethods = GetCheckedPaymentMethods();

            AppConfigManager.SetAppConfigValue("PaymentMethods", checkedPaymentMethods);

            if (AppConfigManager.AppConfigExists("PaymentGateway"))
            {
                var newGateway = getSelectedGateway();

                if (!string.IsNullOrEmpty(newGateway))
                {
                    AppConfigManager.SetAppConfigValue("PaymentGateway", newGateway);
                }

                if (newGateway == "PayFlowPro")
                {
                    var newGatewayProduct = getSelectedGatewayProduct();
                    AppConfigManager.SetAppConfigValue("PayFlowPro.Product", newGatewayProduct);

                    // If PPA Gateway is selected, then set the PPA Method
                    if (newGatewayProduct == "PayPal Payments Advanced")
                    {
                        if (!checkedPaymentMethods.Contains("PayPalPaymentsAdvanced"))
                        {
                            var currentPaymentMethods = AppConfigManager.GetAppConfigValue("PaymentMethods");
                            AppConfigManager.SetAppConfigValue("PaymentMethods", string.Format("{0}, PayPalPaymentsAdvanced", currentPaymentMethods));
                        }
                    }

                    // if any PayFlow gateway is selected, select PayPalExpress
                    if (!checkedPaymentMethods.Contains("PayPalExpress"))
                    {
                        var currentPaymentMethods = AppConfigManager.GetAppConfigValue("PaymentMethods");
                        AppConfigManager.SetAppConfigValue("PaymentMethods", string.Format("{0}, PayPalExpress", currentPaymentMethods));
                        cbxPayPalExpress.Checked = true;
                    }
                }
            }

            string BuySafeMessage = string.Empty;

            if (rblBuySafeEnabled.SelectedIndex == 1)
            {
                var bss = BuySafeController.BuySafeOneClickSignup();
                if (!bss.Sucessful)
                {
                    BuySafeMessage = "buySAFE could not be enabled.{0}";
                    var buysafeResponse = string.IsNullOrEmpty(bss.ErrorMessage) ? "" : " Error message: " + bss.ErrorMessage;
                    ctrlAlertMessage.PushAlertMessage(string.Format(BuySafeMessage, buysafeResponse), AlertMessage.AlertType.Error);
                }
            }

            var errors = new StringBuilder();
            var webMgr = new WebConfigManager();

            if (AppLogic.TrustLevel == AspNetHostingPermissionLevel.Unrestricted)
            {
                if (webMgr.ProtectWebConfig != rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase) || rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                {
                    webMgr.ProtectWebConfig = rblEncrypt.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase);

                    if (rblStaticMachineKey.SelectedValue.Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        webMgr.SetMachineKey          = true;
                        webMgr.ValidationKeyGenMethod = WebConfigManager.KeyGenerationMethod.Auto;
                        webMgr.DecryptKeyGenMethod    = WebConfigManager.KeyGenerationMethod.Auto;
                    }

                    var saveWebConfigExceptions = webMgr.Commit();

                    var webMgrNew = new WebConfigManager();

                    if (saveWebConfigExceptions.Count > 0 && (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig || rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true")))
                    {
                        if (webMgr.ProtectWebConfig != webMgrNew.ProtectWebConfig)
                        {
                            errors.Append("Your web config encryption could not be changed due to the following error(s): <br />");
                        }

                        if (rblStaticMachineKey.SelectedValue.EqualsIgnoreCase("true"))
                        {
                            errors.Append("Could not set static machine key due to the following error(s): <br />");
                        }

                        foreach (var ex in saveWebConfigExceptions)
                        {
                            errors.Append(ex.Message + "<br />");
                        }
                    }
                }
            }

            if (BadSSL)
            {
                errors.AppendFormat("{0}<br />", AppLogic.GetString("admin.wizard.BadSSL", ThisCustomer.LocaleSetting));
            }

            if (!webMgr.WebConfigRequiresReload)
            {
                Response.Redirect("wizard.aspx");
            }

            var errorMessage = errors.ToString();

            if (string.IsNullOrEmpty(errorMessage))
            {
                ctrlAlertMessage.PushAlertMessage(AppLogic.GetString("admin.wizard.success", ThisCustomer.LocaleSetting), AlertMessage.AlertType.Success);
            }
            else
            {
                ctrlAlertMessage.PushAlertMessage(errorMessage, AlertMessage.AlertType.Error);
            }

            loadData();
        }
Esempio n. 6
0
        protected override void OnPreInit(EventArgs e)
        {
            if (HttpContext.Current != null)
            {
                m_ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer;


                int StoreID = AppLogic.StoreID();
                m_SkinID = AppLogic.GetStoreSkinID(StoreID);

                //TODO: review this
                if (CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()))
                {
                    int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString());
                    if (skinFromProfile > 0)
                    {
                        m_SkinID = skinFromProfile;
                    }
                }
                else if (AppLogic.AppConfig("Signin.SkinMaster").EqualsIgnoreCase("session"))
                {
                    m_SkinID = m_ThisCustomer.DBSkinID;
                }

                if (CommonLogic.QueryStringUSInt("skinid") > 0)
                {
                    m_SkinID = CommonLogic.QueryStringUSInt("skinid");
                }

                if (CommonLogic.QueryStringUSInt("affiliateid") > 0)
                {
                    HttpContext.Current.Profile.SetPropertyValue("AffiliateID", CommonLogic.QueryStringUSInt("affiliateid").ToString());
                }

                if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Authority != HttpContext.Current.Request.Url.Authority)
                {
                    HttpContext.Current.Profile.SetPropertyValue("Referrer", HttpContext.Current.Request.UrlReferrer.ToString());
                }


                if (AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("GoogleCheckout.ShowOnCartPage"))
                {
                    String s = (String)HttpContext.Current.Cache.Get("GCCallbackLoadCheck");
                    if (s == null)
                    {
                        String notused = CommonLogic.AspHTTP(AppLogic.GetStoreHTTPLocation(false) + "gccallback.aspx?loadcheck=1", 10);
                        HttpContext.Current.Cache.Insert("GCCallbackLoadCheck", "true", null, System.DateTime.Now.AddMinutes(5), TimeSpan.Zero);
                    }
                }

                // don't fire disclaimer logic on admin pages
                if (!AppLogic.IsAdminSite && CommonLogic.QueryStringCanBeDangerousContent("ReturnURL").IndexOf(AppLogic.AppConfig("AdminDir")) == -1 && (AppLogic.AppConfigBool("SiteDisclaimerRequired") && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0))
                {
                    String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING");
                    Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL));
                }

                bool IGDQueryClear = false;
                m_IGD = CommonLogic.QueryStringCanBeDangerousContent("IGD").Trim();
                if (m_IGD.Length == 0 && CommonLogic.ServerVariables("QUERY_STRING").IndexOf("IGD=") != -1)
                {
                    m_IGD         = String.Empty; // there was IGD={blank} in the query string, so forcefully clear IGD!
                    IGDQueryClear = true;
                }
                bool IsStartOfImpersonation = m_IGD.Length != 0; // the url invocation starts the impersonation only!

                if (!IGDQueryClear && m_IGD.Length == 0)
                {
                    if (m_ThisCustomer.IsAdminUser)
                    {
                        // pull out the impersonation IGD from the customer session, if any
                        m_IGD = m_ThisCustomer.ThisCustomerSession["IGD"];
                    }
                }

                if (IGDQueryClear)
                {
                    // forcefully clear any IGD for this customer, just to be safe!
                    m_ThisCustomer.ThisCustomerSession["IGD"] = "";
                    m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = "";
                }

                Customer PhoneCustomer = null;
                if (m_IGD.Length != 0)
                {
                    if (m_ThisCustomer.IsAdminUser)
                    {
                        try
                        {
                            Guid IGD = new Guid(m_IGD);
                            PhoneCustomer = new Customer(IGD);
                            PhoneCustomer.IsImpersonated = true;
                        }
                        catch
                        {
                            m_ThisCustomer.ThisCustomerSession["IGD"] = "";
                            m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = "";
                            m_IGD = string.Empty;
                        }
                    }
                    if (PhoneCustomer != null && PhoneCustomer.HasCustomerRecord)
                    {
                        int ImpersonationTimeoutInMinutes = AppLogic.AppConfigUSInt("ImpersonationTimeoutInMinutes");
                        if (ImpersonationTimeoutInMinutes == 0)
                        {
                            ImpersonationTimeoutInMinutes = 20;
                        }
                        if (PhoneCustomer.ThisCustomerSession.LastActivity >= DateTime.Now.AddMinutes(-ImpersonationTimeoutInMinutes))
                        {
                            m_ThisCustomer.ThisCustomerSession["IGD"] = IGD;
                            m_AdminCustomer = m_ThisCustomer; // save the owning admin user doing the impersonation here
                            m_ThisCustomer  = PhoneCustomer;  // build the impersonation customer the phone order customer
                            bool IsAdmin = CommonLogic.ApplicationBool("IsAdminSite");

                            if (!HttpContext.Current.Items.Contains("IsBeingImpersonated"))
                            {
                                HttpContext.Current.Items.Add("IsBeingImpersonated", "true");
                            }
                        }
                        else
                        {
                            if (HttpContext.Current.Items.Contains("IsBeingImpersonated"))
                            {
                                HttpContext.Current.Items["IsBeingImpersonated"] = "false";
                            }
                            m_ThisCustomer.ThisCustomerSession["IGD"] = "";
                            m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = "";
                            m_IGD = string.Empty;
                            //Response.Redirect("t-phoneordertimeout.aspx");
                            Response.Redirect(SE.MakeDriverLink("phoneordertimeout"));
                        }
                    }
                }

                Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(Localization.GetDefaultLocale());
                Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting);

                m_Parser = new Parser(m_EntityHelpers, m_SkinID, m_ThisCustomer);

                m_TemplateName = GetTemplateName();

                #region Vortx Mobile Modification
                if (!AppLogic.IsAdminSite)
                {
                    m_ThisCustomer = MobileRedirectController.SkinBaseHook(SkinID, ThisCustomer);
                    SkinID         = ThisCustomer.SkinID;
                    if (SkinID == Vortx.Data.Config.MobilePlatform.SkinId && MobileHelper.isMobile())
                    {
                        m_TemplateName = "template.master";
                    }
                }
                #endregion

                String SkinDirectory = String.Empty;
                String PageTheme     = String.Empty;

                SkinDirectory = "Skin_" + this.SkinID.ToString();
                PageTheme     = "Skin_" + this.SkinID.ToString();

                if (!m_TemplateName.EndsWith(".master", StringComparison.OrdinalIgnoreCase))
                {
                    m_TemplateName = m_TemplateName + ".master";
                }

                this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName;
                this.Theme          = PageTheme;

                if (!CommonLogic.FileExists(this.MasterPageFile))
                {
                    this.SkinID = AppLogic.DefaultSkinID();

                    m_TemplateName = "template.master";
                    SkinDirectory  = "Skin_" + this.SkinID.ToString();
                    PageTheme      = "Skin_" + this.SkinID.ToString();

                    this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName;
                    this.Theme          = PageTheme;
                }

                HttpContext.Current.Profile.SetPropertyValue("SkinID", this.SkinID.ToString());

                if (ThisCustomer.SkinID != this.SkinID)
                {
                    ThisCustomer.SkinID = this.SkinID;
                    ThisCustomer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", this.SkinID) });
                }
            }

            base.OnPreInit(e);
        }