Example #1
0
 /// <summary>
 /// Raises when a session is abandoned or expires.
 /// </summary>
 /// <param name="sender">The sourceRow of the event.</param>
 /// <param name="e">An EventArgs that contains the event data.</param>
 protected virtual void Session_End(object sender, EventArgs e)
 {
     if (Micajah.Common.Pages.PageStatePersister.IsInUse && FrameworkConfiguration.Current.WebApplication.ViewState.DeleteExpiredViewState)
     {
         ViewStateProvider.DeleteExpiredViewState();
     }
 }
Example #2
0
        /// <summary>
        /// Loads the view and control states from SQL database.
        /// </summary>
        public override void Load()
        {
            if (!this.Page.EnableViewState)
            {
                return;
            }

            IsInUse = true;

            Guid viewStateId = Guid.Empty;

            if (Page.Request[ViewStateKeyName] != null)
            {
                object obj = Support.ConvertStringToType(Page.Request[ViewStateKeyName], typeof(Guid));
                if (obj != null)
                {
                    viewStateId = (Guid)obj;
                }
            }

            if (viewStateId != Guid.Empty)
            {
                Pair statePair = ViewStateProvider.GetViewState(viewStateId, this.StateFormatter);
                if (statePair != null)
                {
                    ViewState    = statePair.First;
                    ControlState = statePair.Second;
                }
            }
        }
Example #3
0
        /// <summary>
        /// Raises when an application is started.
        /// </summary>
        /// <param name="sender">The sourceRow of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        protected virtual void Application_Start(object sender, EventArgs e)
        {
            RegisterResourceVirtualPathProvider();
            Resources.ResourceManager.IgnoreCase = true;

            if (Micajah.Common.Pages.PageStatePersister.IsInUse && FrameworkConfiguration.Current.WebApplication.ViewState.DeleteExpiredViewState)
            {
                ViewStateProvider.DeleteExpiredViewState();
            }
        }
Example #4
0
        /// <summary>
        /// Persists the view and control states in SQL database.
        /// </summary>
        public override void Save()
        {
            if (!this.Page.EnableViewState)
            {
                return;
            }
            if ((ViewState == null) && (ControlState == null))
            {
                return;
            }

            IsInUse = true;

            Guid viewStateId = Guid.NewGuid();

            ViewStateProvider.InsertViewState(viewStateId, this.StateFormatter, new Pair(ViewState, ControlState));

            Page.ClientScript.RegisterHiddenField(ViewStateKeyName, viewStateId.ToString("N"));
        }