Passing Values Between Web Forms Pages

  • Thread starter Thread starter cgia
  • Start date Start date
C

cgia

I am porting an old client/server application to asp.net. I used to
retrieve data into local tables (Paradox table-files on the client's
disk) and work on them before saving them back to the server. What is
the approach for this in asp.net? The comments in MSDN on using the
session object are scary, imagining that several users at the same
time will use plenty of space on the server's memory! Or is it
realistic to memorize the data in a page and access them from the
following pages?
Thank for your help!
 
There are a lot of options to transferring values between pages: Session
like you've mentioned, The querystring (of course), But you may want to look
into Server.Transfer and the Context Object.

I hope this leads you in the right direction.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
You can add objects to the HttpContext of the current Page, and then use
Server.Transfer to transfer to the next page. The HttpContext is transferred
as well, and you can pull the data from the original page out of that.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.
 
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79
 
Actually what I want to transfer between forms is huge tables... do
you think it is appropriate to use the server.transfer?
 
Yes, that seems like one of the more efficient solutions for this particular
problem.
 
Back
Top