473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

large objects in viewstate - bad idea?

I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve

Nov 19 '05 #1
10 1815
ok, I read that the entire viewstate is copied to the browser. So a
million byte email message in viewstate is not a good idea :).

Session state is all server, correct? I can generate a guid key, store
my large serialized object in session state, and store the guid key in
the view state of the user control?

thanks,

-Steve
Steve Richter wrote:
I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve


Nov 19 '05 #2
Well, it's not necessarily a bad idea to put large items in ViewState, but
you pay the cost by doing so. Yes it's stored in a hidden input. In ASP.NET
2.0 there's a PageAdapter that can be configured to store the ViewState in
Session state, thus minmizing ViewState. You can do this yourself in v1.x
by overriding SavePageStateTo PersistenceMedi um and LoadPageStateFr omPersistenceMe dium.

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve


Nov 19 '05 #3
Hi Steve,

Everything is relative <g>...

Viewstate is sent back and forth between the server and the client, so it
gets embedded into the page when it's created and sent back to you when the
form is POSTEd. As you might expect that creates overhead in terms of hte
size of the page being transferred. In addition ASP.NET has to encode
viewstate (both encrypt and then base64 encode if EnableViewState Mac is
true) which also has some overhead.

I try to avoid viewstate whenever I can, but there are some scenarios where
viewstate can be very beneficial in performance and maintaining state on a
page.
+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog
"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve

Nov 19 '05 #4
Whatever you do, you should consider a compression technique to reduce the
actual amount of data stored.
"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve

Nov 19 '05 #5

Scott M. wrote:
Whatever you do, you should consider a compression technique to reduce the
actual amount of data stored.
is such a thing part of .net?



"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve


Nov 19 '05 #6
Hi,

won't using a compression technique increase the overhead?

Also, This would have to be manually handled by the programmer to compress
the data of the control then put it in viewstate and later to uncompress the
data to process it.
or does Asp.Net provide a easy way to do this?
--
--Vijay R
"Scott M." wrote:
Whatever you do, you should consider a compression technique to reduce the
actual amount of data stored.
"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I have some potentially large objects I would like to store in the
viewstate of a user control. Large as in an entire email message. Is
ViewState not the sort of place to store such an object?

I think my question and concern depends on what asp.net does with the
view state when the page is written to the browser. Is the entire
viewstate contents written to the browser as a hidden field? Or are
the view state contents stored on the server and only a key of some
sorts is written to the browser?

thanks,

-Steve


Nov 19 '05 #7
I don't believe so, but there are many 3rd party solutions to this problem.
"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** ************@z1 4g2000cwz.googl egroups.com...

Scott M. wrote:
Whatever you do, you should consider a compression technique to reduce
the
actual amount of data stored.


is such a thing part of .net?



"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
>I have some potentially large objects I would like to store in the
> viewstate of a user control. Large as in an entire email message. Is
> ViewState not the sort of place to store such an object?
>
> I think my question and concern depends on what asp.net does with the
> view state when the page is written to the browser. Is the entire
> viewstate contents written to the browser as a hidden field? Or are
> the view state contents stored on the server and only a key of some
> sorts is written to the browser?
>
> thanks,
>
> -Steve
>

Nov 19 '05 #8
Why would compressing the data increase overhead? I don't believe .NET
includes compression classes, but there are 3rd party classes that can do
this. If you were able to reduce the size of the data by 50% (the OP said
he wants to store text from emails so 50% is very reasonable), the bandwidth
savings would negate the processing time needed to do the compression.
"Vijay" <Vi****@discuss ions.microsoft. com> wrote in message
news:06******** *************** ***********@mic rosoft.com...
Hi,

won't using a compression technique increase the overhead?

Also, This would have to be manually handled by the programmer to compress
the data of the control then put it in viewstate and later to uncompress
the
data to process it.
or does Asp.Net provide a easy way to do this?
--
--Vijay R
"Scott M." wrote:
Whatever you do, you should consider a compression technique to reduce
the
actual amount of data stored.
"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
>I have some potentially large objects I would like to store in the
> viewstate of a user control. Large as in an entire email message. Is
> ViewState not the sort of place to store such an object?
>
> I think my question and concern depends on what asp.net does with the
> view state when the page is written to the browser. Is the entire
> viewstate contents written to the browser as a hidden field? Or are
> the view state contents stored on the server and only a key of some
> sorts is written to the browser?
>
> thanks,
>
> -Steve
>


Nov 19 '05 #9
And if you don't mind using API, there is LZ32.dll (the LZ* functions). :)

"Scott M." <s-***@nospam.nosp am> ¼¶¼g©ó¶l¥ó·s»D: Or************* @TK2MSFTNGP09.p hx.gbl...
I don't believe so, but there are many 3rd party solutions to this problem.
"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** ************@z1 4g2000cwz.googl egroups.com...

Scott M. wrote:
Whatever you do, you should consider a compression technique to reduce
the
actual amount of data stored.


is such a thing part of .net?



"Steve Richter" <St************ @gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
>I have some potentially large objects I would like to store in the
> viewstate of a user control. Large as in an entire email message. Is
> ViewState not the sort of place to store such an object?
>
> I think my question and concern depends on what asp.net does with the
> view state when the page is written to the browser. Is the entire
> viewstate contents written to the browser as a hidden field? Or are
> the view state contents stored on the server and only a key of some
> sorts is written to the browser?
>
> thanks,
>
> -Steve
>


Nov 19 '05 #10

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

Similar topics

5
7257
by: Michael Albanese | last post by:
Can you save objects a (custom class) to Viewstate and then get them on a later page?? I have a custom class for an ASP.Net application that I would like to make available across several web pages. For example: page1.aspx accepts a users's name, age and gender, instantiated the new class and redirects to page2.aspx
3
1013
by: Shaul Feldman | last post by:
The question is quiet difficult to explain - I need to give the users ability to append to a table rows, that means I have to reconstruct it every time there's a PostBack i nOnInit event. The question how can I remember how many rows were sent to client before the last submit? I've read a little bit about viewstate and tried to make a hidden label (with runat=server property), but couldn't retrieve its' value fro ViewState. Please help....
1
2014
by: igitur | last post by:
Hi all, I have a custom collection derived from System.Collections.Specialized.NameObjectCollectionBase. NameObjectCollectionBase already implements ISerializable, so it should be easy to store in the ViewState, right? I'm, however, unable to do so. I can add the collection object successfully, but with the page reload, it tells me the ViewState is
6
4346
by: clsmith66 | last post by:
Is it possible to store the same information about a control that would be saved in the ViewState in a Session state? I have a page with three treeview controls and if I enable the view state for the controls I get huge delays on postbacks, but if I disable the viewstate I lose all my information. Any sugesstions?
0
793
by: David Helgason | last post by:
I think those best practices threads are a treat to follow (might even consider archiving some of them in a sort of best-practices faq), so here's one more. In coding an game asset server I want to keep a large number of file revisions of varying sizes (1Kb-50Mb) inside the database. Naturally I want to avoid having to allocate whole buffers of 50Mb too often.
10
3092
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web config does specify a machinekey setting: <machineKey validationKey="447C05E8B3A71401CC4CAE5513A7F1A3494A3618EE819316AAD1D58433F236A759D66FB4154500E01EB4E1BC1DE42046E2D652D391CB8367A1649438867A02EB"...
1
1941
by: William Sullivan | last post by:
I've got a website that may, on occasion, display a large list of items in a bulletedlist control. On the client side, it takes about 4 seconds to get a response that weighs in at over 1mb. It takes less than a second to display those nodes. That part is fine The problem is that when the user causes a postback, the browser appears to lock up for anywhere between 10-20 seconds, at which point it renders the response from the server. ...
0
4818
by: rmgalante | last post by:
Hi, I've been experimenting with the ASP.Net GridView and encountered some interesting issues that I thought I would share. I have a page that loads a GridView with a generic collection of objects. For the purposes of this discussion, the objects define a Customer, and have an id and a name. I want to sort these customers by id or by name in ascending and descending order. Here is what I did to make it work.
3
1300
by: Jens-Oliver Murer | last post by:
Hello, I have a problem with an ASP.Net-application which generates very large source codes which have to be sent to the clients through 'thin' lines. The main problem seems to be a Datagrid which contains several hundred rows (I'd split them, but our customer wants it this way). I already disabled the ViewState and cut the source by nearly half. I use two datagrids on the page, which can be displayed alternately by setting the...
0
9568
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
10007
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...
0
9835
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
8832
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...
0
6649
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
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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 we have to send another system
3
2806
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.