Beispiel #1
0
        protected override void SavePageStateToPersistenceMedium(object state)
        {
            Pair pair;
            PageStatePersister persister = this.PageStatePersister;
            object             viewState;

            if (state is Pair)
            {
                pair = (Pair)state;
                persister.ControlState = pair.First;
                viewState = pair.Second;
            }
            else
            {
                viewState = state;
            }

            LosFormatter formatter = new LosFormatter();
            StringWriter writer    = new StringWriter();

            formatter.Serialize(writer, viewState);
            string viewStateStr = writer.ToString();

            byte[] data           = Convert.FromBase64String(viewStateStr);
            byte[] compressedData = zipHelper.Compress(data);
            string str            = Convert.ToBase64String(compressedData);

            persister.ViewState = str;
            persister.Save();
        }
Beispiel #2
0
        private void InnerSavePageStateToPersistenceMedium(object state)
        {
            ViewStatePersistSettings settings = ViewStatePersistSettings.GetConfig();

            if (settings.Enabled)
            {
                PageStatePersister persister = settings.Persister;

                if (state is Pair)
                {
                    Pair statePair = (Pair)state;

                    persister.ControlState = statePair.First;
                    persister.ViewState    = statePair.Second;
                }
                else
                {
                    persister.ViewState = state;
                }

                persister.Save();

                this.PageStatePersister.ViewState    = persister.ViewState;
                this.PageStatePersister.ControlState = persister.ControlState;

                this.PageStatePersister.Save();
            }
            else
            {
                base.SavePageStateToPersistenceMedium(state);
            }
        }
Beispiel #3
0
        protected override void SavePageStateToPersistenceMedium(Object pViewState)
        {
            Pair               pair;
            object             viewState;
            PageStatePersister persister = this.PageStatePersister;

            if (pViewState is Pair)
            {
                pair = (Pair)pViewState;
                persister.ControlState = pair.First;
                viewState = pair.Second;
            }
            else
            {
                viewState = pViewState;
            }
            persister.ViewState = VeiwStateSerialize.Serialize(viewState);
            persister.Save();
        }
Beispiel #4
0
        /// <summary>
        /// 存入ViewState对象
        /// </summary>
        /// <param name="state"></param>
        protected override void SavePageStateToPersistenceMedium(object state)
        {
            PageStatePersister ps = this.PageStatePersister;

            if (state is Pair)
            {
                Pair pair = (Pair)state;
                ps.ControlState = pair.First;
                ps.ViewState    = pair.Second;
            }
            else
            {
                ps.ViewState = state;
            }
            if (ps.ControlState != null)
            {
                ps.ControlState = SerializeObj(ps.ControlState);
            }
            if (ps.ViewState != null)
            {
                ps.ViewState = SerializeObj(ps.ViewState);
            }
            ps.Save();
        }