HttpContext.Current.Session problem

Discussion in 'ASP .Net Web Controls' started by Julia, Jun 21, 2006.

  1. Julia

    Julia Guest

    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
     
    Julia, Jun 21, 2006
    #1
    1. Advertising

  2. 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
    "Julia" <> ha scritto nel messaggio
    news:D...
    > 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
     
    Alessandro Zifiglio, Jun 23, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. moondaddy
    Replies:
    2
    Views:
    17,979
    Eric Lawrence [MSFT]
    Feb 29, 2004
  2. Kevin Yu
    Replies:
    5
    Views:
    590
    Kevin Yu
    Jan 25, 2005
  3. Jason
    Replies:
    15
    Views:
    7,678
    Patrice
    Feb 11, 2005
  4. Replies:
    2
    Views:
    751
    William F. Robertson, Jr.
    May 16, 2005
  5. Tony

    Dim context As HttpContext = HttpContext.Current

    Tony, Mar 2, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    348
    Teemu Keiski
    Mar 3, 2004
Loading...

Share This Page