protected override void SavePageStateToPersistenceMedium(object state) { base.SavePageStateToPersistenceMedium(state); try { HttpContext context = HttpContext.Current; AbleCommerceApplicationSection appConfig = AbleCommerceApplicationSection.GetSection(context.ApplicationInstance); if ((context.Trace.IsEnabled) || (appConfig.ViewStateWarning > 0)) { //THE SERIALIZATION CODE WILL FAIL IF THE PAGE CONTAINS THE FCKEDITOR //AND THE APP IS RUNNING UNDER MEDIUM TRUST LosFormatter format = new LosFormatter(); StringWriter writer = new StringWriter(); format.Serialize(writer, state); int viewStateLength = writer.ToString().Length; context.Trace.Warn("ViewState Size", viewStateLength.ToString() + "b"); if ((appConfig.ViewStateWarning > 0) && (viewStateLength > appConfig.ViewStateWarning)) { string viewStateWarning = string.Format("ViewState Size {0}! Page: {1}", viewStateLength, context.Request.Path); Logger.Error(viewStateWarning); } } } catch { } }
static ContextCache() { AbleCommerceApplicationSection appConfig = AbleCommerceApplicationSection.GetSection(); _ContextCacheSize = appConfig.ContextCacheSize; }