简体   繁体   中英

Asp.net cache query

I currently have an asp.net website that stores all the viewstate on the server side. I have come across one issue. I have a landing page that lists a number of stats in a gridview, each row having a "view" button which goes to a page containing a detailed list of the selected stat.

If the user uses their back button to get back to the main list and repeat the process of pressing the "view" button after 10 repeats the initial landing page loses all state. I have got round this by setting the <sessionPageState historySize="40"> in the web config which allows the above process to be repeated 40 times until the initial landing page loses all state and needs fully reloading.

Now this fixes the issue here but obviously has an issue on other pages by leading to a large sessionstate when users use the rest of the site. What is the best method to get round this?

Thanks

View State is designed for storing the state of objects on the page being loaded. It isn't stored server side and is a collection of the page's controls and their values in a Base 64 encoded string sent out with the page.

For passing data between pages you should look at Session which will persist for as long as the user is active (until Session expires or you manually kill it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM