将ViewState放在Session里

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace EntLibSample
{
     public class BasePage : System.Web.UI.Page
     {
         protected override void SavePageStateToPersistenceMedium( object viewState)
         {
             Session[ "viewState" + this .Context.Request.FilePath] = viewState;
         }
 
         protected override object LoadPageStateFromPersistenceMedium()
         {
             if (Session[ "viewState" + this .Context.Request.FilePath] != null )
             {
                 return Session[ "viewState" + this .Context.Request.FilePath];
             }
             return string .Empty;
         }
     }
}

你可能感兴趣的:(session)