SQLServer session statemanagement: Round trips on every access?

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
 
E

Eliyahu Goldin

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
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top