Reputation: 1955
Currently I am storing the DataSet in a ViewState but, this may have an impact on the performance of the page.
Can you suggest me whether I can use Session or ViewState or any alternative by which it doesn't impact the performance?
Upvotes: 4
Views: 6835
Reputation: 2075
Why do you need to store the whole dataset? If you have to, then do it in session. If your session is "inproc" the dataset object will be stored in memory (you save some performance because there will be no serialization).
If I was you, I would analyze the code and try not to store the whole dataset in neither session, not viewstate - there must be a way to optimize your code.
Upvotes: 3
Reputation: 65
If you want to store the whole dataSet there is always the Caching method wich will allow you to store huge variable with good performance. Here an example of how you can store a variable into Cache.
Cache["CacheItem1"] = "Cached Item 1";
And this how to retrive the variable after:
string cachedString;
cachedString = (string)Cache["CacheItem"];
Upvotes: 2
Reputation: 15851
as i think storing in session will may help you, but you need to think follwing points
I suggest you look on your requirement, if possible, you can store on cache, but it is application level. as Session Each User has its own session .
you can check the follwing links
Upvotes: 1
Reputation: 3243
Storing a dataset in viewstate or session is ill-advised, but out of the two, storing it in session is definitely better than viewstate. Since then the serialization/de-serialization is handled at the server. Rather than sending the serialized data to the client as well.
Upvotes: 1