Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Maintaining Application State In Listing 28.11, a DataView object is stored in Session state. When you sort the GridView control, the DataView is sorted. The page in Listing 28.11 includes a link that enables you to reload the page. The sort order of the records displayed by the GridView is remembered across page requests. The sort order is remembered even if you navigate to another page before returning to the page. Using the Session Object The main application programming interface for working with Session state is the HttpSessionState class. This object is exposed by the Page.Session, Context.Session, UserControl.Session, WebService.Session, and Application.Session. | 1284 CHAPTER 28 Maintaining Application State form body html In Listing 28.11 a DataView object is stored in Session state. When you sort the GridView control the DataView is sorted. The page in Listing 28.11 includes a link that enables you to reload the page. The sort order of the records displayed by the GridView is remembered across page requests. The sort order is remembered even if you navigate to another page before returning to the page. Using the Session Object The main application programming interface for working with Session state is the HttpSessionState class. This object is exposed by the Page.Session Context.Session UserControl.Session WebService.Session and Application.Session properties. This means that you can access Session state from just about anywhere. This HttpSessionState class supports the following properties this is not a complete list CookieMode Enables you to specify whether cookieless sessions are enabled. Possible values are AutoDetect UseCookies UseDeviceProfile and UseUri. Count Enables you to retrieve the number of items in Session state. IsCookieless Enables you to determine whether cookieless sessions are enabled. IsNewSession Enables you to determine whether a new user session was created with the current request. IsReadOnly Enables you to determine whether the Session state is read-only. Keys Enables you to retrieve a list of item names stored in Session state. Mode Enables you to determine the current Session state store provider. Possible values are Custom InProc Off SqlServer and StateServer. SessionID Enables you to retrieve the unique session identifier. Timeout Enables you to specify the amount of time in minutes before the web server assumes that the user has left and discards the session. The maximum value is 525 600 1 year . The HttpSessionState object also supports the following methods Abandon Enables you to end a user session. Clear Enables you to clear all items from Session state. Remove Enables you to remove a .