SQLServer session statemanagement: Round trips on every access?

  • Thread starter Thread starter Yash
  • Start date Start date
Y

Yash

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
 
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
 
Back
Top