473,888 Members | 1,528 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 1471
"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
2615
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
1658
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
2155
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
1442
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
1618
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
11769
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
5747
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
4129
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
9961
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...
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10438
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
9597
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...
0
7148
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
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
4243
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.