public override void Load()
        {
            NameValueCollection requestValueCollection = Page.RequestValueCollection;

            if (requestValueCollection == null)
            {
                return;
            }

            string viewStateString = null;

            try {
                viewStateString = Page.RequestViewStateString;

                // VSWhidbey 160556
                if (!String.IsNullOrEmpty(viewStateString) || !String.IsNullOrEmpty(Page.ViewStateUserKey))
                {
                    Pair combinedState = (Pair)Util.DeserializeWithAssert(StateFormatter2, viewStateString, Purpose.WebForms_HiddenFieldPageStatePersister_ClientState);
                    ViewState    = combinedState.First;
                    ControlState = combinedState.Second;
                }
            }
            catch (Exception e) {
                // throw if this is a wrapped ViewStateException -- mac validation failed
                if (e.InnerException is ViewStateException)
                {
                    throw;
                }

                ViewStateException.ThrowViewStateError(e, viewStateString);
            }
        }
 public override void Load()
 {
     if (base.Page.RequestValueCollection != null)
     {
         string requestViewStateString = null;
         try
         {
             requestViewStateString = base.Page.RequestViewStateString;
             if (!string.IsNullOrEmpty(requestViewStateString) || !string.IsNullOrEmpty(base.Page.ViewStateUserKey))
             {
                 Pair pair = (Pair)Util.DeserializeWithAssert(base.StateFormatter, requestViewStateString);
                 base.ViewState    = pair.First;
                 base.ControlState = pair.Second;
             }
         }
         catch (Exception exception)
         {
             if (exception.InnerException is ViewStateException)
             {
                 throw;
             }
             ViewStateException.ThrowViewStateError(exception, requestViewStateString);
         }
     }
 }
Пример #3
0
 private void EnsureEventValidationFieldLoaded()
 {
     if (!this._eventValidationFieldLoaded)
     {
         this._eventValidationFieldLoaded = true;
         string str = null;
         if (this._owner.RequestValueCollection != null)
         {
             str = this._owner.RequestValueCollection["__EVENTVALIDATION"];
         }
         if (!string.IsNullOrEmpty(str))
         {
             IStateFormatter formatter = this._owner.CreateStateFormatter();
             ArrayList       list      = null;
             try
             {
                 list = formatter.Deserialize(str) as ArrayList;
             }
             catch (Exception exception)
             {
                 ViewStateException.ThrowViewStateError(exception, str);
             }
             if ((list != null) && (list.Count >= 1))
             {
                 int    num = (int)list[0];
                 string requestViewStateString = this._owner.RequestViewStateString;
                 if (num != StringUtil.GetStringHashCode(requestViewStateString))
                 {
                     ViewStateException.ThrowViewStateError(null, str);
                 }
                 this._clientPostBackValidatedEventTable = new HybridDictionary(list.Count - 1, true);
                 for (int i = 1; i < list.Count; i++)
                 {
                     int num3 = (int)list[i];
                     this._clientPostBackValidatedEventTable[num3] = null;
                 }
                 if (this._owner.IsCallback)
                 {
                     this._validEventReferences = list;
                 }
             }
         }
     }
 }