I'm using a viewstate key/value to store a serialized instance of a class.
If I redirect to another aspx page, the viewstate is lost. Is this the
intended behavior of the viewstate? Is there a work around? Cookies, I
suppose.
Thanks,
Craig Buchanan 5 1649
Hi,
by default ViewState is page-specific. And yes, it is designed to be so.
Workaround can be basically anything where you can serialize your class
instance like cookie (means just serilalization to string in that case).
Easiest way to get over it would be using Session as in InProc mode it can
hold any class instance without serializing.
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Craig Buchanan" <so*****@somewh ere.com> wrote in message
news:eV******** *****@TK2MSFTNG P11.phx.gbl... I'm using a viewstate key/value to store a serialized instance of a class. If I redirect to another aspx page, the viewstate is lost. Is this the intended behavior of the viewstate? Is there a work around? Cookies, I suppose.
Thanks,
Craig Buchanan
hi,
ViewSate works on "hidden" textboxes placed on a particular page
i.e pageSpecific
if u want to maintain state over pages. then there
are:
Session and
Cookies to rely on ..
there is also the Cache class to work witth
which can persist over pages.
bye
amit
"Craig Buchanan" <so*****@somewh ere.com> wrote in message
news:eV******** *****@TK2MSFTNG P11.phx.gbl... I'm using a viewstate key/value to store a serialized instance of a class. If I redirect to another aspx page, the viewstate is lost. Is this the intended behavior of the viewstate? Is there a work around? Cookies, I suppose.
Thanks,
Craig Buchanan
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
Amit-
Thanks for the response. Two questions:
1) are .Net session objects scalable?
2) what are the pros/cons for a cache class?
Thanks,
Craig
"Amit Agarwal" <ammnbgd@rediff com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. hi, ViewSate works on "hidden" textboxes placed on a particular page i.e pageSpecific if u want to maintain state over pages. then there are: Session and Cookies to rely on .. there is also the Cache class to work witth which can persist over pages.
bye
amit
"Craig Buchanan" <so*****@somewh ere.com> wrote in message news:eV******** *****@TK2MSFTNG P11.phx.gbl... I'm using a viewstate key/value to store a serialized instance of a
class. If I redirect to another aspx page, the viewstate is lost. Is this the intended behavior of the viewstate? Is there a work around? Cookies, I suppose.
Thanks,
Craig Buchanan
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
Persisting data is a real problem in ASP.Net due to the stateless nature of
HTTP. When talking about persisting a value, you need to think about scope.
How long do you want the variable to exist? What should it be exposed to?
For example, should it have Application Scope, so that any page being viewed
by any user can access it? Should it be in Session State, so that each user
has their own separate variable that remains for the lifetime of the User
Session? Should it have Page scope, such as ViewState, so that it is
persisted only for the duration of the current Page and PostBacks of that
Page? Should it be stored in a database, where it will persist permanently,
and is still avialable to any Page that needs it for any user? The more
carefully you consider this question, the less you'll have to change later.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Craig Buchanan" <so*****@somewh ere.com> wrote in message
news:eV******** *****@TK2MSFTNG P11.phx.gbl... I'm using a viewstate key/value to store a serialized instance of a class. If I redirect to another aspx page, the viewstate is lost. Is this the intended behavior of the viewstate? Is there a work around? Cookies, I suppose.
Thanks,
Craig Buchanan
no,
in a web app there are hundreds of users hitting a site..
so ifu put everything in session say ten variables in session
so for 100 users i will multiply
and so that much load on the server.
so one shud uses session sparingly
for imp tasks only like
username.
where r u from ..
amit agarwal
india
"Craig Buchanan" <so*****@somewh ere.com> wrote in message
news:eQ******** ******@TK2MSFTN GP09.phx.gbl... Amit-
Thanks for the response. Two questions:
1) are .Net session objects scalable? 2) what are the pros/cons for a cache class?
Thanks,
Craig
"Amit Agarwal" <ammnbgd@rediff com> wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. hi, ViewSate works on "hidden" textboxes placed on a particular page i.e pageSpecific if u want to maintain state over pages. then there are: Session and Cookies to rely on .. there is also the Cache class to work witth which can persist over pages.
bye
amit
"Craig Buchanan" <so*****@somewh ere.com> wrote in message news:eV******** *****@TK2MSFTNG P11.phx.gbl... I'm using a viewstate key/value to store a serialized instance of a class. If I redirect to another aspx page, the viewstate is lost. Is this
the intended behavior of the viewstate? Is there a work around? Cookies,
I suppose.
Thanks,
Craig Buchanan
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.572 / Virus Database: 362 - Release Date: 1/27/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.573 / Virus Database: 363 - Release Date: 1/28/2004 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: neo |
last post by:
hi,
I am studying ASP.NET and have few questions -
1) The session ID and values of controls is stored in VIEWSTATE
variable. So now when we put EnableViewState="false" in Page directive and
disable the session state in Web.Config the VIEWSTATE variable is still
maintained and stores some values. Can anyone tell what those values are
for, i.e what other info is stored in VIEWSTATE other than the session ID
and the control values ?
|
by: Kevin Gorski |
last post by:
This question has been asked before, but there have been no definitive
answers that I was able to find. Can the viewstate hidden input field
be moved to a less prominent page location? On an otherwise
well-optimised page a large viewstate can be detrimental to it's
page-ranking since the content is pushed further from the beginning of
the document.
Thanks for any help.
|
by: Simon |
last post by:
Hi everyone,
I have a quick question that I hope someone can help me with:
I've made a user control that contains a text box and some validation
functionality. This control has a few extra properties declared on it over
and above that provided by the textbox.
As I understand it, part of the process to make this work is, in the
property accessor's for the properties that you wish to persist you add
|
by: et |
last post by:
I'm not sure I understand the use of the ViewState.
Do I understand correctly that values of controls are automatically held in
a hidden control called ViewState?
If so, then why can't we get them, or how do we get that value? I always
have to set the ViewState("FirstName") = txtBox.text myself before a
postback is done, otherwise, the value of ViewState("FirstName") is always
empty; there doesn't seem to be a way to retrieve that...
|
by: olduncleamos |
last post by:
Hello all,
I am experimenting with the repeater control and ran into something
that I wasn't expecting. I would appreciate if the experts can confirm
or correct my understanding.
Here is a fragment of a very simple page that I wrote that will drill
down into the displayed item. The result is to be display on the same
page so that the user can keep on drilling down:
| |
by: John |
last post by:
Hi all,
I am using dynamic user controls within my web app and these controls are
loaded into placeholders via the LoadControl method.
My problem is this:
I have usercontrolA loaded into a placholder and the user clicks on a
specific control outside of the usercontrol and some Javascript is run where
a hidden variable is changed to reflect another usercontrol (usercontrolB).
|
by: Mark Broadbent |
last post by:
Been a while since I've touched asp.net but one thing that always seems to
fustrate me is the loss of state on variable declarations. Is there anyway
(i.e. assigning an attribute etc) to instruct the server to remember a
variables state *without* having to go through the rigmarole of saving and
loading to and from the Session state manually or similar workaround for any
Types (including custom types) in exactly the same way web controls...
|
by: Mark Olbert |
last post by:
I have a "master" composite control which, in turn, holds an instance of a "detail" composite control (the "master" control will
ultimately contain multiple instances of the "detail" control, but I'm keeping things simple to try and figure out what's going
wrong). The master control supports databinding.
Upon postback, the detail control is not retrieving its state from ViewState after it is created and added to the master control
during...
|
by: Justin |
last post by:
I have aspx pages with 10 checkboxlist controls. total individual checkbox
(the sum of individual checbox in those 10 checkboxlists) on the page is
about 1710. You can imagine how large the viewstate is. Is there anyway I
can shrink the viewstate and at the same time get the values of each
checkbox after postback?
Thanks
|
by: =?Utf-8?B?TUNN?= |
last post by:
I'm sure the answer to my question varies depending on the situation, but I
am looking for a general "best practice".
If I have an asp.net application and I load certain data from a database,
should I use ViewState to store and reload the data, or should I load the
data from the database on each postback?
Assume for the sake of this question that I only care about performance, I
don't care about ease of programming.
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |