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

large objects in viewstate - bad idea?

P: n/a
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
Share this Question
Share on Google+
10 Replies


P: n/a
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

P: n/a
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 SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium.

-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

P: n/a
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 EnableViewStateMac 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.googlegr oups.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

P: n/a
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.googlegr oups.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

P: n/a

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.googlegr oups.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

P: n/a
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.googlegr oups.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

P: n/a
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********************@z14g2000cwz.googlegrou ps.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.googlegr oups.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

P: n/a
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****@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.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.googlegr oups.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

P: n/a
And if you don't mind using API, there is LZ32.dll (the LZ* functions). :)

"Scott M." <s-***@nospam.nospam> 撰寫於郵件新聞:Or*************@TK2MSFTNGP09.phx.gb l...
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********************@z14g2000cwz.googlegrou ps.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.googlegr oups.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

P: n/a
Plus get around the 4K viewstate limit imposed by some proxy server, I would
say.

"Scott M." <s-***@nospam.nospam> 撰寫於郵件新聞:%2***************@TK2MSFTNGP15.phx. gbl...
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****@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.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.googlegr oups.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 #11

This discussion thread is closed

Replies have been disabled for this discussion.