I have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've been
told that I am gettign DNS timeouts because of the ViewState being too large.
I'm trying to avoid writing manual paging routines for now.
--
Tim 6 2076
Hi Tim,
View State can be customized to be stored in a Session or Cache object. It
is done by overriding the 'SavePageStateT oPersistenceMed ium' and
'LoadPageStateF romPersistenceM edium' methods. (see code snippet below)
protected override void SavePageStateTo PersistenceMedi um(Object viewState)
{
string _vskey;
_vskey = "VIEWSTATE_ " + base.Session.Se ssionID + "_" + Request.RawUrl +
"_" + System.DateTime .Now.Ticks.ToSt ring();
Cache.Add(_vske y, viewState, null,
System.DateTime .Now.AddMinutes (Session.Timeou t), Cache.NoSliding Expiration,
CacheItemPriori ty.Default, null);
RegisterHiddenF ield("_VIEWSTAT E_KEY", _vskey);
}
protected override object LoadPageStateFr omPersistenceMe dium()
{
string _vskey = Request.Form["_VIEWSTATE_KEY "];
if (_vskey == null)
{
return null;
}
else
{
return Cache[_vskey];
}
}
Advantages: If the ViewState is large, it increases the page size
considerably and results in an increase in response time (page load time).
Saving the ViewState to a session/cache can result in an improved response
time (page size is reduced considerably). On the other hand, it can consume
server resources (which can be handled by improving the hardware).
Regards,
Augustin
"AAOMTim" wrote:
I have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've been
told that I am gettign DNS timeouts because of the ViewState being too large.
I'm trying to avoid writing manual paging routines for now.
--
Tim
Here is a link ( http://www.eggheadcafe.com/articles/20040613.asp) to a
customised persistence mechanism that we implement recently.
A number of our customers share 512/128 DSL connections between a number of
staff, and the posting back of large viewstates was causing significant
performance issues for them.
We choose to store the viewstate in a SQL store, and although this incurs an
extra database hit, that hit is significantly less than the round trip of a
large viewstate to the browser and back.
<DIV>"AAOM Tim" <AA*****@dis cussions.micros oft.com> wrote in
message news:3E******** *************** ***********@mic rosoft.com...</DIV>>I
have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've
been
told that I am gettign DNS timeouts because of the ViewState being too
large.
I'm trying to avoid writing manual paging routines for now.
--
Tim
Thank you for your response. Can you discuss the merits of saving to a Cache
object instead of to a Session?
--
Tim
"Augustin Prasanna" wrote:
Hi Tim,
View State can be customized to be stored in a Session or Cache object. It
is done by overriding the 'SavePageStateT oPersistenceMed ium' and
'LoadPageStateF romPersistenceM edium' methods. (see code snippet below)
protected override void SavePageStateTo PersistenceMedi um(Object viewState)
{
string _vskey;
_vskey = "VIEWSTATE_ " + base.Session.Se ssionID + "_" + Request.RawUrl +
"_" + System.DateTime .Now.Ticks.ToSt ring();
Cache.Add(_vske y, viewState, null,
System.DateTime .Now.AddMinutes (Session.Timeou t), Cache.NoSliding Expiration,
CacheItemPriori ty.Default, null);
RegisterHiddenF ield("_VIEWSTAT E_KEY", _vskey);
}
protected override object LoadPageStateFr omPersistenceMe dium()
{
string _vskey = Request.Form["_VIEWSTATE_KEY "];
if (_vskey == null)
{
return null;
}
else
{
return Cache[_vskey];
}
}
Advantages: If the ViewState is large, it increases the page size
considerably and results in an increase in response time (page load time).
Saving the ViewState to a session/cache can result in an improved response
time (page size is reduced considerably). On the other hand, it can consume
server resources (which can be handled by improving the hardware).
Regards,
Augustin
"AAOMTim" wrote:
I have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've been
told that I am gettign DNS timeouts because of the ViewState being too large.
I'm trying to avoid writing manual paging routines for now.
--
Tim
Thanks for the response. How would you compare the efficiency of saving your
ViewState to a SQL Store as compared to saving it to Cache?
--
Tim
"Dave Moyle" wrote:
Here is a link (http://www.eggheadcafe.com/articles/20040613.asp) to a
customised persistence mechanism that we implement recently.
A number of our customers share 512/128 DSL connections between a number of
staff, and the posting back of large viewstates was causing significant
performance issues for them.
We choose to store the viewstate in a SQL store, and although this incurs an
extra database hit, that hit is significantly less than the round trip of a
large viewstate to the browser and back.
<DIV>"AAOMTim " <AA*****@discus sions.microsoft .comwrote in
message news:3E******** *************** ***********@mic rosoft.com...</DIV>>I
have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've
been
told that I am gettign DNS timeouts because of the ViewState being too
large.
I'm trying to avoid writing manual paging routines for now.
--
Tim
Hi Tim
When we looked at the article I mentioned, we saw that using the cache was
perhaps the most efficient custom store.
For us the potential memory footprint of using the cache was a risk and as a
result we didn't even test the real world response times using the cache. We
run multiple servers in a farm and so our application already used SQL as
the session store, and that gave us immediate scalability.
As I mentioned previously, the saving we made just using the SQL store was
significant, so we have not had the need to try and squeeze any blood from
the stone if you will.
Dave
<DIV>"AAOM Tim" <AA*****@dis cussions.micros oft.com> wrote in
message news:80******** *************** ***********@mic rosoft.com...</DIV>>
Thanks for the response. How would you compare the efficiency of saving
your
ViewState to a SQL Store as compared to saving it to Cache?
--
Tim
"Dave Moyle" wrote:
>Here is a link (http://www.eggheadcafe.com/articles/20040613.asp) to a customised persistence mechanism that we implement recently.
A number of our customers share 512/128 DSL connections between a number of staff, and the posting back of large viewstates was causing significant performance issues for them.
We choose to store the viewstate in a SQL store, and although this incurs an extra database hit, that hit is significantly less than the round trip of a large viewstate to the browser and back.
<DIV>"AAOMTi m" <AA*****@discus sions.microsoft .comwrote in message news:3E******* *************** ************@mi crosoft.com...</DIV>>I have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've
been
told that I am gettign DNS timeouts because of the ViewState being too
large.
I'm trying to avoid writing manual paging routines for now.
--
Tim
Tim,
Cache is a more efficient way of persisting data on the server side. It
exposes many properties that can be used to control the manner in which data
is cached. More than that, if the resources are low, runtime can purge some
of the items that are stored in the cache (which will not happen when session
is used) you can find lots of articles on cache and it's features.
Regards,
Augustin http://augustinprasanna.blogspot.com
"AAOMTim" wrote:
Thank you for your response. Can you discuss the merits of saving to a Cache
object instead of to a Session?
--
Tim
"Augustin Prasanna" wrote:
Hi Tim,
View State can be customized to be stored in a Session or Cache object. It
is done by overriding the 'SavePageStateT oPersistenceMed ium' and
'LoadPageStateF romPersistenceM edium' methods. (see code snippet below)
protected override void SavePageStateTo PersistenceMedi um(Object viewState)
{
string _vskey;
_vskey = "VIEWSTATE_ " + base.Session.Se ssionID + "_" + Request.RawUrl +
"_" + System.DateTime .Now.Ticks.ToSt ring();
Cache.Add(_vske y, viewState, null,
System.DateTime .Now.AddMinutes (Session.Timeou t), Cache.NoSliding Expiration,
CacheItemPriori ty.Default, null);
RegisterHiddenF ield("_VIEWSTAT E_KEY", _vskey);
}
protected override object LoadPageStateFr omPersistenceMe dium()
{
string _vskey = Request.Form["_VIEWSTATE_KEY "];
if (_vskey == null)
{
return null;
}
else
{
return Cache[_vskey];
}
}
Advantages: If the ViewState is large, it increases the page size
considerably and results in an increase in response time (page load time).
Saving the ViewState to a session/cache can result in an improved response
time (page size is reduced considerably). On the other hand, it can consume
server resources (which can be handled by improving the hardware).
Regards,
Augustin
"AAOMTim" wrote:
I have a large ViewState and I've heard I can save the ViewState in a sesison
object. What are the advantages of doing so and how do I do it? I've been
told that I am gettign DNS timeouts because of the ViewState being too large.
I'm trying to avoid writing manual paging routines for now.
--
Tim
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 ?
|
by: Lisa |
last post by:
I have a web app that gets a recordset from the database and fills a
grid. You can drilldown from this table to a detail table.
Because the tables sometimes get huge, and because I have to go back
to the database again every time I postback anyway, I wanted to
disable ViewState in the grids. Just to minimize the amount of stuff
that gets...
|
by: Ralph Krausse |
last post by:
ViewState = "Bill";
-- This statement will send that to the browser and hash it into the
__VIEWSTATE hidden varible
Application = "Bill";
-- This statement will keep this info on the server
Session = "Bill";
-- This statement will keep this info on the server
|
by: Edward Yang |
last post by:
When it comes to ViewState in ASP.NET, I have a mixed feeling of both
love and hate. For love, it simplifies many aspects of common tasks; for
hate, it bloats web pages with large amount of cryptic (though not
really :-)) text.
I find that LOS formatter is not as effecient as what Microsoft claims.
It takes up much of CPU time. For example,...
|
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?
| |
by: MattC |
last post by:
With respect to Peter Bromberg's article (
http://www.eggheadcafe.com/articles/20040613.asp ) I wish to store my
viewstate info in the Session object rather than the cache (as it is per
user info). I have tried the following but am unable to serialize the
viewstate??
protected override void SavePageStateToPersistenceMedium(object...
|
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...
|
by: Irene |
last post by:
Hello all!
I'm creating a web site in ASP.NET (VB.NET). One of the requirements was to
allow users to create orders going through several steps. A must have is to
have an option to save the work in any phase (any step) and to be able to
continue later.
My idea was to create several pages as steps (no, wizard control is not
suitable for...
|
by: chike_oji |
last post by:
Please can someone help me. I am writing a web application,
that allows for the upload of an excel sheet into the database.
I have an upload button and a save button.
The upload button allows for the retrieval of the excel data into
a DataTable, which is bound to a GridView for previewing before
saving to the Database.
But, whenever I...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |