473,654 Members | 3,060 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): +27831421491753 59
More ways to contact me: http://wwp.icq.com/149175359
_______________ _______________ ___________
Nov 18 '05 #1
5 4130
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************ *********@elici t.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): +27831421491753 59
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************ *********@elici t.se> wrote in
message news:uT******** ******@tk2msftn gp13.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): +27831421491753 59 More ways to contact me: http://wwp.icq.com/149175359
_______________ _______________ ___________

Nov 18 '05 #3
"Joakim Westman (Elicit AB)" <_n************ *********@elici t.se> wrote in
message news:uT******** ******@tk2msftn gp13.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): +27831421491753 59
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

SavePageStateTo PersistenceMedi um() and
LoadPageStateFr omPersistenceMe dium()

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************ *********@elici t.se> wrote in
message news:uT******** ******@tk2msftn gp13.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): +27831421491753 59 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
3057
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 similar to HttpContext.Current.Session that allows a business object to access the current Session ?
3
4738
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 cannot write to web.config so I cannot dynamically update the credentials while the site is up. Since the FormsAuthentication.Authenticate() method's documentations claims the following: "Attempts to validate the credentials against those contained...
1
3743
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 with line 4, my application works. Using Line 1 in combination with line 3 (and of course renaming httpSessionState1 to httpSessionState) results in the error as mentioned below. protected override object LoadPageStateFromPersistenceMedium() {
2
1271
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 wrote a Discussion forum that worked client side via JScript that initiated home-brew RPC calls in XML format (I wrote it pre-soap, or -- more precisely -- before I knew about SOAP...) something like:...
3
4561
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 set textboxes, radio buttons, etc - that viewstate is fine. Then I have a linkbutton that does a Server.Transfer over to Page2.aspx. When I Server.Transfer back to Page1.aspx, the viewstate info is lost. I ran across another example of this last...
7
2103
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 I'm sure this will offend some of the more seasoned verterans of this board. The Players: Consider a simple web form, which I'll call Page A, that has a couple of controls on it. It's not important what they are, only that they're static...
6
1589
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 SESSION and that worked. Am I correct in assuming ViewState is cleared on each PageLoad or is my code incorrect. VIEWSTATE If IsNothing(ViewState("PbCounter")) Then
2
4748
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 the datatable.The datatable obtained is a large one.I want this table to be in memory(I dont know how to),as I have to use the same datatable for enabling paging in gridview. In short,my problem is ,I need to store the datatable (which is filled...
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.