Transferring Form Field values to "page 2"

  • Thread starter Thread starter G
  • Start date Start date
G

G

Hello,

I have a "two page form" - Page1.aspx and Page2.aspx.

I have a function in my Page1.cs file called Button_Click.

A simple version:
************************
if (Page.IsValid)
{
Response.Redirect("page2.aspx?FirstName=" + FirstName.Text + ");
}
************************
FirstName is a form field on page 1. The redirect works fine, however I
would prefer that the form values from page 1 did not appear in the URL of
page 2:

For example it currently looks like this:
page2.aspx?FirstName=Gary

Using classic ASP, I would normally use client side validation and then
SUBMIT USING POST TO page2. With .NET the page submits to itself and then
redirects to Page2 and this is similar to a post via GET. What is the best
way to hide the querystring?

Regards,

Gary.
 
I have just looked at Server.Transfer and it seems like a good method for
this task...
Might give it a bash.

G.
 
Hello G,

are you using ASP.NET 2.0? Wizard or MultiView control can help you to do
this in one page. In other case you can always use Session to store values
from first page or Server.Transfer to access page2 without round trip to
client = with current request.

Regards,
Ladislav Mrnka
 
use Server.Transfer, or use client script like in asp. client script can
change to form action to the new url. you could also create a second
form (after the main one) for use by client script.

-- bruce (sqlwork.com)
 
Back
Top