Difference between Cache,Session,Application,View

2019-06-14 07:03发布

I want to store some data during my site viewing.

Sometime i need to store large data like crystal reports and some times i need to store a string.

So which is best to use and when to use. Where are these datas stored. i.e., Client or Server

3条回答
贼婆χ
3楼-- · 2019-06-14 07:37

What you are asking is about State Management in ASP.NET. What you have actually listed is Server Side state management options.

You can made a choice of which to use depending on your requirement or functionality.

I will recommend you do some background reading on MSDN regarding State Management. I am not sure which answer you need here as your query is a bit generic.

Here is a link to get you started... http://msdn.microsoft.com/en-us/library/75x4ha6s.aspx

查看更多
混吃等死
4楼-- · 2019-06-14 07:46

This is a very open ended question. Ass Julius said you need to learn more about the different ways you can store information. For example, Application is used when you want to store information on the initial startup of the site and make it available to all users. Session is for a single user so you may have many sessions open depending on how many users you have online at that time. Cache is also a way you can store information on the server. All of these are stored on the server so if you have hundreds of users online at the same time, server memory will be consumed holding all this information. Rule of thumb is to try to be conservative when storing information in these locations. Personally, I rarely use application and also try to limit my use of session to when it makes sense. If I were to write an app that used crystal reports as you are, I would probably use sql to store the paramaters of the report and generate the report from the parameters but it depends entirely on the needs of the user using the app.

You can find a wealth of infomation on this subject on line. Hopefully this will give you some information.

查看更多
登录 后发表回答