澄清一下,SQLViewstateProvider 不是应用程序范围的实现。您必须创建一个继承自 System.Web.UI.Page 对象并覆盖父页面类的保存和加载视图状态方法的类。对于您希望将视图状态保存在服务器端的每个页面,您必须从新创建的页面模板继承(这反过来又继承并覆盖了 System.WEb.UI.Page 类)。
所以它是在每页的基础上应用的,而不是在应用程序范围的基础上应用的。
HEADS UP: Some controls might contain some client-side javascript code which may reference the viewstate on client-side (duh). If the viewstate is now stored on server-side you will get a null-reference exception (for instance, clicking a commandfield in a gridview). I'm working on a workaround for this problem, but unfortunately I do not have any concrete solution as of yet.