473,804 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I'm confused (Viewstate and Context)

Hi,

I'm trying to pass information between pages. I'm trying to avoid using
QueryString and Session variables. I saw somewhere that I could use
contxt.Items.Ad d (combined with Server.Transfer ) to store my
information and send it to another page. Some of my pages, either go to
other pages, or postback depending on the situation. When I began to
get confused was when I saw that I needed to store my variables on the
viewstate if I wanted to postback. So any answers to the next questions
could really help me understand all of this.

1. Isn't the context stored on the viewstate?
2. If that's the case, what would be the use of using the context
object if I'm going to end up storing everything on the viewstate to
get the info on postback, and also wouldn't I be duplicating my
viewstate when I and I reset my context variables, to do
Server.Transfer , because my viewstate already has that info.
3. What would be the best way to pass information, I'm only trying to
persist three variables, nothing more than that.

I know I must probably misunderstood the context object or the
viewstate. I really need somebody to get me out of my confusion.

Thanks

Nov 19 '05 #1
1 1457
"Hugo Flores" <hu*********@ge .com> wrote in
news:11******** **************@ f14g2000cwb.goo glegroups.com:
1. Isn't the context stored on the viewstate?
No, context items are sent as part of the server.transfer . After the
server.transfer , context items are disposed.
2. If that's the case, what would be the use of using the context
object if I'm going to end up storing everything on the viewstate to
get the info on postback, and also wouldn't I be duplicating my
viewstate when I and I reset my context variables, to do
Server.Transfer , because my viewstate already has that info.
You can't send viewstate between pages.
3. What would be the best way to pass information, I'm only trying to
persist three variables, nothing more than that.


Page A, use httpcontext to send the variables to Page B. In Page B, save
the variables to a viewstate variable which can be used during a
postback.

Or, use a session variable.

Or use a querystring.

There's nothing wrong with using a querystring - if you're querying
against public data (i.e. non secured data).
--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2

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

Similar topics

2
2609
by: Mike | last post by:
hi to all does any body know or receive this message before and how i can repare this: The viewstate is invalid for this page and might be corrupted. thank's Mike
10
1654
by: Lloyd Dupont | last post by:
When you define UserControl in source code the sample I see are often like that: ============ public string Text { get { String s = (String)ViewState; return ((s == null) ? String.Empty : s); }
7
2154
by: GS | last post by:
Hello, I'm receiving The state information is invalid for this page and might be corrupted error message when running code below. This happens on second post back. Why is it happening? My webpage contains 2 dropdowns controls and I save information entered by user in ViewState variable containing array ArrayList MyCoordinates = (ArrayList) ViewState ; if (MyCoordinates == null) { MyCoordinates = new ArrayList ();
4
1437
by: John | last post by:
Hi, I derived a class from the Hashtable class, with ISerializable implemented and the tag added. Everything works fine with one exception. I store the hashtable in ViewState, but on a postback, the object in ViewState changes to Hashtable, instead of MyHashtable. I'm assuming this is a simple serialization setting, but I can't seem to
6
1611
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 IsNothing(ViewState("PbCounter")) Then
1
11767
by: Dhruba Bandopadhyay | last post by:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. The above message is what I get in my ASP.NET 2.0 page. I have debugging turned on and for those who want to see the stack trace, see below. In my old web site I had a frame set with a ASP page in left frame...
0
5745
by: tynorton | last post by:
Hey, I've been working on this issue for a while now, with no leads or success. The scenario is a homemade modal dialog using UpdatePanels. There a couple ImageButtons inside of usercontrols with their OnClick events delegated to file.aspx. Here is my error (These happen fairly infrequently, say, 5-10 times an
5
4126
by: John Kotuby | last post by:
Hi all, After more than a year programming with ASP.NET 2.0 and VB I am still finding it difficult to leave some habits from classic ASP behind. this is particularly true with cross-page posting. My site uses Master pages and user controls. On an Advanced Search page I have numerous entry boxes and listboxes (keywords, categories, etc.) which are primarily standard HTML. I post this page to a different page which lists results and...
3
680
by: sck10 | last post by:
Hello, I have a web project (VS 2008 c#). I have a page that opens, but when I try to call an assembly (managed c++) on a submit event, I get the following error on the web server, but not on my development machine. It seems that this is the only dll in the Bin folder that has this problem. Any help with this would be appreciated. Thanks, sck10
0
9712
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...
1
10341
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,...
0
10089
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
9171
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...
1
7634
isladogs
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...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4308
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
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.