473,503 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Store viewstate in session?

Hi!
I have a page that generates a lot of HTML, and I am considering different
solutions to constrain the amount of
code that is sent back to the client.

One thing I thought about is the viewstate which is fairly large for this
application.

Does anybody have any experience on storing viewstate in Session.

I know that sessionState has a mode for storing inProc, SqlServer etc, but I
doesn't seem like viewstate has come this far yet.
I know there are methods to override to do this, but will it work out you
think?

Cheers,
// Joakim W

_________________________________________ Joakim Westman ICQ#:149175359
Current ICQ status: SMS: (Send an SMS message to my ICQ): +2783142149175359
More ways to contact me: http://wwp.icq.com/149175359
_________________________________________
Nov 18 '05 #1
5 4117
IMHO - keeping Viewstate in Session is going to require a good chunk
of memory on the server. I think it would work for a small number of
users - but not knowing your app or user base its hard to tell where
the line would be drawn. I'm sure it would limit your scalabiity.

Check out "The ASP.NET View State"
http://msdn.microsoft.com/msdnmag/is...2/cuttingedge/

There is a discussion on keeping viewstate server side and some pros
and cons.

--
Scott
http://www.OdeToCode.com

On Tue, 20 Jan 2004 10:00:17 +0100, "Joakim Westman \(Elicit AB\)"
<_n*********************@elicit.se> wrote:
Hi!
I have a page that generates a lot of HTML, and I am considering different
solutions to constrain the amount of
code that is sent back to the client.

One thing I thought about is the viewstate which is fairly large for this
application.

Does anybody have any experience on storing viewstate in Session.

I know that sessionState has a mode for storing inProc, SqlServer etc, but I
doesn't seem like viewstate has come this far yet.
I know there are methods to override to do this, but will it work out you
think?

Cheers,
// Joakim W

_________________________________________ Joakim Westman ICQ#:149175359
Current ICQ status: SMS: (Send an SMS message to my ICQ): +2783142149175359
More ways to contact me: http://wwp.icq.com/149175359
_________________________________________


Nov 18 '05 #2
Kind of like storing a box inside a box, don't you think? Perhaps just the
times IN the box...

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Joakim Westman (Elicit AB)" <_n*********************@elicit.se> wrote in
message news:uT**************@tk2msftngp13.phx.gbl...
Hi!
I have a page that generates a lot of HTML, and I am considering different
solutions to constrain the amount of
code that is sent back to the client.

One thing I thought about is the viewstate which is fairly large for this
application.

Does anybody have any experience on storing viewstate in Session.

I know that sessionState has a mode for storing inProc, SqlServer etc, but I doesn't seem like viewstate has come this far yet.
I know there are methods to override to do this, but will it work out you
think?

Cheers,
// Joakim W

_________________________________________ Joakim Westman ICQ#:149175359
Current ICQ status: SMS: (Send an SMS message to my ICQ): +2783142149175359 More ways to contact me: http://wwp.icq.com/149175359
_________________________________________

Nov 18 '05 #3
"Joakim Westman (Elicit AB)" <_n*********************@elicit.se> wrote in
message news:uT**************@tk2msftngp13.phx.gbl...
Hi!
I have a page that generates a lot of HTML, and I am considering different
solutions to constrain the amount of
code that is sent back to the client.

One thing I thought about is the viewstate which is fairly large for this
application.
This is certainly possible. Before making this determination, look at the
actual size of the code sent by getting the file size out of your Internet
cache. You may find that, despite looks, it is only a few kb.
Does anybody have any experience on storing viewstate in Session.
If you mean actually storing that string in Session? Hold out your knuckles!
Whack! Whack! Whack!

If you mean storing the info/variables, sure, you can do that. Consider some
different store, however, as it is unlikely you are using all of the info
with every page hit. Only store stuff in session that is used very
frequently. The rest should be put in a persistant store, like a database.
I know that sessionState has a mode for storing inProc, SqlServer etc, but I doesn't seem like viewstate has come this far yet.
I know there are methods to override to do this, but will it work out you
think?


ViewState will NEVER come "this far". ViewState is a method of working state
into a stateless environment. As the entire contents are stored in an
encrypted string, you do not need anything else to complete a transaction
with the user. You do not need session state, you do not need
authentication. Etc. Etc. It is not the best method for every application,
however.

The basic idea here is ViewState is meant to be sent to the client, period.
Storing in Session, SQL Server, et al, puts the data on the Server, not the
client. This is not the design goal for ViewState.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
Nov 18 '05 #4
Joakim Westman (Elicit AB) wrote:
Hi!
I have a page that generates a lot of HTML, and I am considering different
solutions to constrain the amount of
code that is sent back to the client.

One thing I thought about is the viewstate which is fairly large for this
application.

Does anybody have any experience on storing viewstate in Session.

I know that sessionState has a mode for storing inProc, SqlServer etc, but I
doesn't seem like viewstate has come this far yet.
I know there are methods to override to do this, but will it work out you
think?

Cheers,
// Joakim W

_________________________________________ Joakim Westman ICQ#:149175359
Current ICQ status: SMS: (Send an SMS message to my ICQ): +2783142149175359
More ways to contact me: http://wwp.icq.com/149175359
_________________________________________


This article:

http://www.aspalliance.com/articleVi...x?aId=135&pId=

has very brief examples showing how to override

SavePageStateToPersistenceMedium() and
LoadPageStateFromPersistenceMedium()

to store viewstate somewhere other than a hidden form field. You can
use a database, or store it in the Session collection.

--
mikeb
Nov 18 '05 #5
Hi!
Thank you all for sharing your views on this topic.
I guess I will do some tests to verify this now.

Cheers,
// Joakim W

"Joakim Westman (Elicit AB)" <_n*********************@elicit.se> wrote in
message news:uT**************@tk2msftngp13.phx.gbl...
Hi!
I have a page that generates a lot of HTML, and I am considering different
solutions to constrain the amount of
code that is sent back to the client.

One thing I thought about is the viewstate which is fairly large for this
application.

Does anybody have any experience on storing viewstate in Session.

I know that sessionState has a mode for storing inProc, SqlServer etc, but I doesn't seem like viewstate has come this far yet.
I know there are methods to override to do this, but will it work out you
think?

Cheers,
// Joakim W

_________________________________________ Joakim Westman ICQ#:149175359
Current ICQ status: SMS: (Send an SMS message to my ICQ): +2783142149175359 More ways to contact me: http://wwp.icq.com/149175359
_________________________________________

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
3028
by: JezB | last post by:
How can I get to a page's ViewState from inside a business object ? I have a reference to the calling page but the ViewState property of the Control class is protected. Is there something...
3
4729
by: Martin | last post by:
Dear fellow ASP.NET programmer, I stared using forms authentication and temporarily used a <credentials> tag in web.config. After I got it working I realized this wasn't really practical. I...
1
3722
by: Ralph Soons | last post by:
Hi all, I am trying to save the viewstate in a session instead of storing it in a hidden of the webpage which is default. This because of performance reasons. When I use line 2 in combination...
2
1266
by: Sky | last post by:
Basically, I'm stumped on how to translate something I wrote in PHP to ASP.NET, and I'm having a hard time figuring out what is right way to do it now... The scenario in PHP was as follows: I...
3
4547
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and...
7
2096
by: Shadow Lynx | last post by:
I realize that his question has been asked, in many other forms, many times in this group. Even so, my tired eyes have not yet found a sufficient answer, so I've decided to "reask" it even though...
6
1580
by: mosscliffe | last post by:
I am testing for how/when a page is posted back and I decided to use a ViewState variable in PageLoad to set up a counter, but it appears, the ViewState is cleared on each PageLoad. So then I used...
2
4739
by: Sobin Thomas | last post by:
Hi All....... I am a beginner in asp.net.I need your help.I have a gridview control in my Default.aspx page.I use data adapter to fill a datatable and then I set the datasource of the gridview as...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
5011
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.