HttpContext.Current.Session problem

J

Julia

Hi

I have developed a custom control. I want to keep a dataset in the:
HttpContext.Current.Session.Add("test", dsProducts);

If I open a browser and then open a new one using Ctrl+n I get problem. I
think the browsers share the same HttpContext.Current.Session so if I change
the dataset in one browser and then want to use the dataset in the other
browser the I get the edited dataset. How can I keep values separeted in two
browsers?

Thanks
Julia
 
A

Alessandro Zifiglio

hi Julia, IMHO, storing a dataset in session is generally not a very good
idea. A session is user specific, so for each user that visits your site you
store a dataset in memory, for the duration of that user session(till the
session timesout), seems to be a waste of resources for you + producing
unwanted behavior as you described. If you need to store that information
for the current page only, you can try and store it in viewstate Versus
storing it in session. Viewstate gets stored in the current page and will
persist across postbacks but not across pages or for the duration of the
user session. The disadvantage might be a heavy page served to the client,
so as you can see there are some tradeoff's.
But you will get the behaviour that you are looking for, that is, it will be
page specific, change made in one page wont effect that other =P

have a good day,
Alessandro Zifiglio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top