Beispiel #1
0
    /// <summary>
    /// Saves any view and control state to appropriate viewstate provider.
    /// This method shields the client from viewstate key generation issues.
    /// </summary>
    /// <param name="viewState"></param>
    protected override void SavePageStateToPersistenceMedium(object viewState)
    {
        // Make up a unique name
        string random = _random.Next(0, int.MaxValue).ToString();
        string name   = "ACTION_" + random + "_" + Request.UserHostAddress + "_" + DateTime.Now.Ticks.ToString();

        ViewStateProviderService.SavePageState(name, viewState);
        ClientScript.RegisterHiddenField("__VIEWSTATE_KEY", name);
    }
Beispiel #2
0
        // Salva qualquer view e control state para o apropriado viewstate provider.
        // Este método salva uma chave gerada para o viewstate.
        protected override void SavePageStateToPersistenceMedium(object pViewState)
        {
            if (ViewStateProviderService.UseProvider)
            {
                // criar um nome único(key).
                string random = _random.Next(0, int.MaxValue).ToString();
                string name   = "ACTION_" + random + "_" + Request.UserHostAddress + "_" + DateTime.Now.Ticks.ToString();

                ViewStateProviderService.SavePageState(name, pViewState);
                ClientScript.RegisterHiddenField("__VIEWSTATE_KEY", name);
            }
            else
            {
                base.SavePageStateToPersistenceMedium(pViewState);
            }
        }