By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,395 Members | 2,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,395 IT Pros & Developers. It's quick & easy.

Storing an entire page's Contents in the Session

P: n/a
py
how feasible is it to cache an entire page's content in a session variable?
i am already doing it and it works fine, except i am afraid of scalability
issues. what is the best way to test this? and is there an obvious reason
why i should not do this.


Nov 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Why would you need to do that ?
The Cache object will do that more efficiently.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"py" <du***********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
how feasible is it to cache an entire page's content in a session
variable?
i am already doing it and it works fine, except i am afraid of scalability
issues. what is the best way to test this? and is there an obvious
reason
why i should not do this.

Nov 19 '05 #2

P: n/a
py
i am simply storing a root level webcontrol that contains all of my page
controls. i believe cache object will purge itself when it runs low. plus,
i dont need to share the page with other sessions - it is just for the
session that is displaying it - i.e. one page per end user, so session level
is the right scope.

it saves asp engine from having to re-instantiate all the controls on each
request and maintains the data state (which i have programmed to time out on
its own)


"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Why would you need to do that ?
The Cache object will do that more efficiently.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"py" <du***********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
how feasible is it to cache an entire page's content in a session
variable?
i am already doing it and it works fine, except i am afraid of
scalability
issues. what is the best way to test this? and is there an obvious
reason
why i should not do this.


Nov 19 '05 #3

P: n/a
Depends what you have there, however if you store something like controls
there, you're shooting yourself to leg for good. All those resources are
tied to the lifetime of a session, and it would be multiplicated per-user
basis.

I'd look into Caching as Juan hinted, depending on your case either data
caching with cache object or outout caching (caching the rendered content)
when you could avoid non-needed caching or cache only the necessary
resource-intensive part.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU

"py" <du***********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
how feasible is it to cache an entire page's content in a session
variable?
i am already doing it and it works fine, except i am afraid of scalability
issues. what is the best way to test this? and is there an obvious
reason
why i should not do this.

Nov 19 '05 #4

P: n/a
>it saves asp engine from having to re-instantiate all the controls on each
request and maintains the data state (which i have programmed to time out
on its own)
Believe me, Framework is optimized this in mind, classes including controls
are instantiated very fast, as they are compiled code etc. and instances odf
compiled page classes are cached after JIT'ing.

Another drawback with your approach is that Controls are not serializable.
This works as long as you have sessions in InProc (in-process) mode, however
if you need to switch to state server or SQL server for better reliability
(to stand app/process restarts), it won't work and you're on your own with
it.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
"py" <du***********@hotmail.com> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...i am simply storing a root level webcontrol that contains all of my page
controls. i believe cache object will purge itself when it runs low.
plus, i dont need to share the page with other sessions - it is just for
the session that is displaying it - i.e. one page per end user, so session
level is the right scope.

it saves asp engine from having to re-instantiate all the controls on each
request and maintains the data state (which i have programmed to time out
on its own)


"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Why would you need to do that ?
The Cache object will do that more efficiently.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

"py" <du***********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
how feasible is it to cache an entire page's content in a session
variable?
i am already doing it and it works fine, except i am afraid of
scalability
issues. what is the best way to test this? and is there an obvious
reason
why i should not do this.



Nov 19 '05 #5

P: n/a
The Viewstate very often already does this in most cases. You should
probably elaborate on what exactly you are trying to do.

Nov 19 '05 #6

P: n/a
As a general rule, caching UI components is a bad idea. Cache is best used
for pure data.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"py" <du***********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
how feasible is it to cache an entire page's content in a session
variable?
i am already doing it and it works fine, except i am afraid of scalability
issues. what is the best way to test this? and is there an obvious
reason
why i should not do this.

Nov 19 '05 #7

P: n/a
py
ok - sounds like sound advice.

another related question:
how much data is reasonable to cache? i am using subclassed datatables as
my data source. when should i worry about memory consumption?

(i am embarassed to admit i dont know how to test for this)

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...
As a general rule, caching UI components is a bad idea. Cache is best used
for pure data.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
What You Seek Is What You Get.

"py" <du***********@hotmail.com> wrote in message
news:u$**************@tk2msftngp13.phx.gbl...
how feasible is it to cache an entire page's content in a session
variable?
i am already doing it and it works fine, except i am afraid of
scalability
issues. what is the best way to test this? and is there an obvious
reason
why i should not do this.


Nov 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.