If I have an object I need to store in viewstate, what kinds of things can I do to optimize the size it takes to store the object? Obviously storing the least amount of data will take less space, but aside from that, are there ways to architect the class, properties, attrbutes etc, that will effect how large the serialized output is?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- Json.NET deserializing contents of a JObject?
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
My basic points.
Also I know that if I use extra List inside my base class they take a lot more space. Here is a sample that you can see by your self by just playing with the points that I mention.
For example if you remove from cEnaText the default value, the viewstate is 50% smaller than is with it. If you place the [NonSerialized] on all variables, then the viewstate is empty. If you make bigger the name, then the viewstate is going bigger.
How to see what actually stored
There are some programs that you can read viewstate, here is one that I found google it.
http://www.binaryfortress.com/aspnet-viewstate-helper/
How to get the idea.
I say that you can use this function to get an idea of what is stored and what is not, and how many infos are going to stored. With this trick you can see in text the final serialized object.
And here how I use this function
Final words
You actual ask here for we can optimize the object and its very good question. The next step is probably to compress the viewstate to make it smaller on transfer back to us.
you can store your viewstate on server check this out:
Server Side Viewstate
There are several factors to consider. You might want to give a little more information on your class, why you need to store it etc.
Old post here on stackoverflow a few optimization strategies are used.
Optimizing ViewState