protected void Page_Load(object sender, System.EventArgs e) { if (AppLogic.AppConfigBool("GoNonSecureAgain")) { SkinBase.GoNonSecureAgain(); } _itemCounter = "ProductID".ToQueryString().TryParseIntUsLocalization().Value; CategoryID = "CategoryID".ToQueryString(); DepartmentID = "DepartmentID".ToQueryString(); ManufacturerID = "ManufacturerID".ToQueryString(); _itemCode = AppLogic.GetItemCodeByCounter(_itemCounter); var eCommerceProductInfoView = AppLogic.GetProductInfoViewForShowProduct(DB.SQuote(_itemCode), DB.SQuote(ThisCustomer.LocaleSetting), DB.SQuote(InterpriseHelper.ConfigInstance.UserCode), DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode), DB.SQuote(Localization.DateTimeStringForDB(DateTime.Now)), DB.SQuote(ThisCustomer.ProductFilterID), DB.SQuote(ThisCustomer.ContactCode)); int sessionLifetime = AppLogic.AppConfigUSInt("ViewedProductsSessionLifetime"); if (sessionLifetime == null) { sessionLifetime = 60; } if (ThisCustomer.ContactCode == "") { RequireCustomerRecord(); } //DateTime expirationdatetime = DateTime.Now.AddMinutes(-sessionLifetime); //string updatevieweditems = // string.Format("exec UpdateEcommerceViewedItems @ExpirationDate = {0}, @WebSiteCode = {1}, @ContactCode = {2}, @ItemCode = {3}, @CurrentDate = {4}, @SessionID = {5}", // DB.SQuote(Localization.DateTimeStringForDB(expirationdatetime)), // DB.SQuote(InterpriseHelper.ConfigInstance.WebSiteCode), // DB.SQuote(ThisCustomer.ContactCode), // DB.SQuote(_itemCode), // DB.SQuote(Localization.DateTimeStringForDB(DateTime.Now)), // ThisCustomer.CurrentSessionID); //DB.ExecuteSQL(updatevieweditems); string itemDescription = string.Empty; if (eCommerceProductInfoView == null) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } if (eCommerceProductInfoView.CheckOutOption) { Response.Redirect(SE.MakeDriverLink("ProductNotFound")); } if (eCommerceProductInfoView.IsCBN == false && AppLogic.IsCBNMode()) { Response.Redirect(SE.MakeDriverLink("MobileProductNotFound")); } string SENameINURL = "SEName".ToQueryStringDecode(); string ActualSEName = eCommerceProductInfoView.ItemDescription.ToMungeName().ToUrlEncode().ToSubString(90); if (string.IsNullOrEmpty(ActualSEName)) { ActualSEName = eCommerceProductInfoView.ItemName.ToMungeName().ToUrlEncode().ToSubString(90); } if (ActualSEName != SENameINURL) { string NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), ActualSEName); string QStr = "?"; var keyvalues = Request.QueryString .ToPairs() .Where(q => q.Key == "productid" && q.Key == "sename") .Select(q => string.Join("=", new[] { q.Key, q.Value + "&" })) .ToArray(); QStr += string.Join("", keyvalues); if (QStr.Length > 1) { NewURL += QStr; } HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } m_XmlPackage = eCommerceProductInfoView.MobileXmlPackage.ToLowerInvariant(); IsAKit = eCommerceProductInfoView.IsAKit.TryParseBool(); IsMatrix = eCommerceProductInfoView.IsMatrix.TryParseBool(); if (m_XmlPackage.Length == 0) { if (IsAKit) { m_XmlPackage = AppLogic.MobileDefaultProductKitXmlPackage; // provide a default } else if (IsMatrix) { m_XmlPackage = AppLogic.MobileDefaultProductMatrixXmlPackage; // provide a default } else { m_XmlPackage = AppLogic.MobileDefaultProductXmlPackage; // provide a default } } RequiresReg = eCommerceProductInfoView.RequiresRegistration; ProductName = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.ItemDescription, ThisCustomer.LocaleSetting, true); CategoryHelper = AppLogic.LookupHelper(base.EntityHelpers, DomainConstants.LOOKUP_HELPER_CATEGORIES); SectionHelper = AppLogic.LookupHelper(base.EntityHelpers, DomainConstants.LOOKUP_HELPER_DEPARTMENT); ManufacturerHelper = AppLogic.LookupHelper(base.EntityHelpers, DomainConstants.LOOKUP_HELPER_MANUFACTURERS); itemDescription = eCommerceProductInfoView.ItemDescription; if (string.IsNullOrEmpty(itemDescription)) { itemDescription = ProductName; } string seITitleTemp = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SETitle, ThisCustomer.LocaleSetting, true); SETitle = string.IsNullOrEmpty(seITitleTemp) ? (AppLogic.AppConfig("StoreName") + " - " + itemDescription).ToHtmlEncode() : seITitleTemp; string seDescription = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SEDescription, ThisCustomer.LocaleSetting, true); SEDescription = string.IsNullOrEmpty(seDescription) ? ProductName.ToHtmlEncode() : seDescription; string seKeywords = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SEKeywords, ThisCustomer.LocaleSetting, true); SEKeywords = string.IsNullOrEmpty(seKeywords) ? ProductName.ToHtmlEncode() : seKeywords; SENoScript = XmlCommon.GetLocaleEntry(eCommerceProductInfoView.SENoScript, ThisCustomer.LocaleSetting, true); CategoryName = (CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting) != String.Empty) ? CategoryHelper.GetEntityField(CategoryID, "Description", ThisCustomer.LocaleSetting) : CategoryHelper.GetEntityName(CategoryID, ThisCustomer.LocaleSetting); SectionName = (SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting) != String.Empty) ? SectionHelper.GetEntityField(DepartmentID, "Description", ThisCustomer.LocaleSetting) : SectionHelper.GetEntityName(DepartmentID, ThisCustomer.LocaleSetting); ManufacturerName = (ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting) != String.Empty) ? ManufacturerHelper.GetEntityField(ManufacturerID, "Description", ThisCustomer.LocaleSetting) : ManufacturerHelper.GetEntityName(ManufacturerID, ThisCustomer.LocaleSetting); if (ManufacturerID.Length != 0) { CookieTool.Add("LastViewedEntityName", "Manufacturer", new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceID", ManufacturerID.ToString(), new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceName", ManufacturerName, new TimeSpan(1, 0, 0, 0, 0)); String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), _itemCode); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (CategoryID.Length != 0) { CookieTool.Add("LastViewedEntityName", "Category", new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceID", CategoryID.ToString(), new TimeSpan(1, 0, 0, 0, 0)); CookieTool.Add("LastViewedEntityInstanceName", CategoryName, new TimeSpan(1, 0, 0, 0, 0)); string NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), _itemCode); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } else if (DepartmentID.Length != 0) { var cookierExpires = new TimeSpan(1, 0, 0, 0, 0); CookieTool.Add("LastViewedEntityName", "Department", cookierExpires); CookieTool.Add("LastViewedEntityInstanceID", DepartmentID.ToString(), cookierExpires); CookieTool.Add("LastViewedEntityInstanceName", SectionName, cookierExpires); String NewURL = AppLogic.GetStoreHTTPLocation(false) + SE.MakeProductLink(_itemCounter.ToString(), _itemCode); HttpContext.Current.Response.Write("<html><head><title>Object Moved</title></head><body><b>Object moved to <a href=\"" + NewURL + "\">HERE</a></b></body></html>"); Response.Status = "301 Moved Permanently"; Response.AddHeader("Location", NewURL); HttpContext.Current.Response.End(); } SourceEntity = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityName", true); string SourceEntityInstanceName = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceName", true); SourceEntityID = CommonLogic.CookieCanBeDangerousContent("LastViewedEntityInstanceID", true); // validate that source entity id is actually valid for this product: if (SourceEntityID.Length != 0) { var alE = AppLogic.GetProductEntityList(_itemCode, SourceEntity); if (alE.Any(i => i == SourceEntityID.TryParseIntUsLocalization())) { SourceEntityID = string.Empty; } } if (SourceEntityID.Length != 0) { PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, false); } else { PickupBreadCrumb(ref SourceEntity, ref SourceEntityInstanceName, ref SourceEntityID, true); } AppLogic.LogEvent(ThisCustomer.CustomerCode, 10, _itemCounter.ToString()); }