• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

transfering data between pages

What is the best way to transfer data from a form to another page?

We're not doing a post to a second page b/c we are hadling the data insert to the DB from webform1.aspx.cs

but we want to display a confirmation page with the values submitted. What would be the best way to do it?

Thanks.
0
epmo
Asked:
epmo
  • 4
  • 3
  • 2
2 Solutions
 
YurichCommented:
I presume there will be more than a few values, so you can probably put'em all in an array, array list, or other collection structure and use

 Session["ArrayListName"] ?

regards
0
 
epmoAuthor Commented:
is session the best way to handle them? is the session object reliable?
0
 
YurichCommented:
well, i'd say it's reliable and a very good way to handle it, but probably you might want to hear somebody's else opinion ;)

regards
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
jj819430Commented:
Session object is very reliable, but there is some debate as to if it is a good idea to use it. One problem is it becomes a nightmare to manage the session between pages if you start blowing it out. But if you know you are going from webform1.aspx -> confirm.aspx during X event. Then put it in session, just make sure and delete them when you are done accessing them on confirm.aspx.

if you have a group of them do this.
using System.Collections;
...
ArrayList ConfirmVariables = new ArrayList();
ConfirmVariables.Add(object you want in there);
Session.Add("ConfirmVars",ConfirmVariables);

on confirm.aspx

using System.Collections
...

ArrayList ConfirmVariables = ((ArrayList)Session["ConfirmVars"]);
there you have them.
0
 
YurichCommented:
to my understanding, there was a different way of passing individual variables between pages but can't recall it how to do it exactly - it was as passing parameters in the address of the page you're calling for... I don't remember syntax and this way was very fast but absolutely unsecure, so probably you wouldn't like to use it anyway...

the only other issue with session is it can take some memory on the server, so, if you have multi-user application and they all simultaneosly passing sessions between their pages, it can become resource-stressful... so delete it when you don't need it as stated above

regards,
yurich
0
 
jj819430Commented:
ah you are talking about through the query string. Basically the way that works is you are tagging on variables at the end of the URL.
you access this with Request.QueryString["VariableName"] and it returns a string.
so you can build a link or url http://whereyouaregoing.com/index.aspx?whoami=jj&wherecanifindstuff=expertsexchange   (yes it is corny)

Request.QueryString["whoami"] == "jj"

and

Request.QueryString["wherecanifindstuff"] == "expertsexchange"

You will want to use the frameworks method for throwing things into the querystring so it can handle all of the special charachters for you.

But remember these need to be validated. These inputs can be malformed by a user.
0
 
epmoAuthor Commented:
hmm..   what about a form "POST"?  
0
 
YurichCommented:
what do you mean by "POST", posting back to the server?
0
 
epmoAuthor Commented:
no we mean, posting a form to a separate page..
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now