best way to transfer variables from 1 page to a 2nd to a 3rd page

N

nicholas

Have a multi-page subscribtion.
So the user fills in some data on the first page, than an other part on the
2nd and the last part on the 3rd page.

What is the best and simplest way to get all the inserted data on the 3rd
page to insert in de dbase?
(not using request.querystring! as this is not secure)

I tried with context, but I can't manage it to work.

Thanks.
 
H

Hans Kesting

nicholas said:
Have a multi-page subscribtion.
So the user fills in some data on the first page, than an other part
on the 2nd and the last part on the 3rd page.

What is the best and simplest way to get all the inserted data on the
3rd page to insert in de dbase?
(not using request.querystring! as this is not secure)

I tried with context, but I can't manage it to work.

Thanks.

You need Session.

page 1: Session["somekey"] = somevalue;

page 2: myvar = (type)Session["somekey"];

Session stores everything as Object, so when you retrieve the value, you need to cast.


Hans Kesting
 
A

Anand S

Nicholas,

Try using Server.Execute or Server.Transfer depending on your need. Also
consider using a public property in the first page which can be accessed
from the second page.

- Anand
 
N

nicholas

thx, but I don't realy like this method.
It's good if you don't have too much variables.

I solved my problem by using "panels".
So there is just 1 form left.

THX anyway.

Hans Kesting said:
nicholas said:
Have a multi-page subscribtion.
So the user fills in some data on the first page, than an other part
on the 2nd and the last part on the 3rd page.

What is the best and simplest way to get all the inserted data on the
3rd page to insert in de dbase?
(not using request.querystring! as this is not secure)

I tried with context, but I can't manage it to work.

Thanks.

You need Session.

page 1: Session["somekey"] = somevalue;

page 2: myvar = (type)Session["somekey"];

Session stores everything as Object, so when you retrieve the value, you need to cast.


Hans Kesting
 
H

Hans Kesting

Anand said:
Nicholas,

Try using Server.Execute or Server.Transfer depending on your need.
Also consider using a public property in the first page which can be
accessed from the second page.

For ASP.Net public properties on pages don't work. You have only a
"live instance" of the current page, not of any previous pages.
 
H

Hans Kesting

nicholas said:
thx, but I don't realy like this method.
It's good if you don't have too much variables.

You don't have to store just "strings" and "ints" in Session, you can also
define your own classes that hold a number of values. You can store that
class (instance) under a single key in Session.

But "panels" is a good solution, just as long as you maintain the "postback"
flow (you can't just redirect to an other page, then you lose all data)

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top