SQLServer session statemanagement: Round trips on every access?

Discussion in 'ASP .Net' started by Yash, Oct 25, 2007.

  1. Yash

    Yash Guest

    Hi,

    I have a very basic question regarding session state management in SQL
    Server.

    In a SINGLE page request, if multiple session variables are accessed,
    will there be multiple roundtrips to the ASPState DB to retrieve the
    values of the variables?

    E.g.
    void func(){
    a = Session["AVAL"] ;
    b = Session["BVAL"] ;
    }
    Will this cause 2 round-trips?

    I would assume that the session data is retrieved just once on first
    access during the page lifecycle. Please confirm my understanding.

    Thanks,
    Yash
    Yash, Oct 25, 2007
    #1
    1. Advertising

  2. For out-of-proc session state every page loads the session during page
    initialization and flushes it after the page has finished rendering. You can
    control this behavior with the EnableSessionState attribute of the Page
    directive. Depending on how the page needs to use session, you can either
    disable it or enable for reading and writing or enable it for reading only.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "Yash" <> wrote in message
    news:...
    > Hi,
    >
    > I have a very basic question regarding session state management in SQL
    > Server.
    >
    > In a SINGLE page request, if multiple session variables are accessed,
    > will there be multiple roundtrips to the ASPState DB to retrieve the
    > values of the variables?
    >
    > E.g.
    > void func(){
    > a = Session["AVAL"] ;
    > b = Session["BVAL"] ;
    > }
    > Will this cause 2 round-trips?
    >
    > I would assume that the session data is retrieved just once on first
    > access during the page lifecycle. Please confirm my understanding.
    >
    > Thanks,
    > Yash
    >
    Eliyahu Goldin, Oct 25, 2007
    #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. Mike

    ListBox and round-trips

    Mike, May 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    391
  2. msnews.microsoft.com
    Replies:
    5
    Views:
    836
    Steve C. Orr [MVP, MCSD]
    Apr 23, 2005
  3. =?Utf-8?B?SmVmZnJleQ==?=

    Upgrading ASP w/SQLserver 2000 to ASP.NET w/ SQLserver 2005

    =?Utf-8?B?SmVmZnJleQ==?=, Apr 6, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    477
    sloan
    Apr 27, 2007
  4. JJ

    Multiple Round Trips

    JJ, Dec 16, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    143
  5. Mike

    ListBox and round-trips

    Mike, May 4, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    121
    Ravikanth[MVP]
    May 5, 2004
Loading...

Share This Page