Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:21:05+00:00 2026-06-18T03:21:05+00:00

I have an ASP.Net form (Page1) where the user enters some data and then

  • 0

I have an ASP.Net form (Page1) where the user enters some data and then clicks the submit button.

As part of Page1, I have some Validators, including a CustomValidator which needs to do its validation back on the server.

When the user clicks the submit button a post is done to Page1 and the validation routine is run on the server and as long as I check Page.IsValid in the button click routine the form knows whether things have passed or not.

When the validation doesn’t pass everything properly goes back to Form1 and the error message is displayed.

When the form does pass validation, I want to pass the data that the user entered to a second form (Page2) so that Page2 can be rendered correctly based on the data the user entered on Page1.

Is there a generally accepted way, or best way, to pass the data to Page2? Here are some ways I know about:

  • Call Page2 with a query string: This won’t work as I need the data to not be visible to the user in certain cases.
  • Use the PostBackUrl on the submit button to go to Page2: As far as I know, this won’t work correctly because then the server side validation routines for Page1 won’t be run.
  • Use Session Variables: I don’t know of a particular reason why this would be bad.
  • Use Server.Transfer: I don’t really have any experience with this.

I would think that this would be a pretty standard thing to do but I’m having a hard time finding any information on the correct way to do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:21:07+00:00Added an answer on June 18, 2026 at 3:21 am

    If you don’t have a form of secondary storage for this data, using either Session storage or Server.Transfer would work.

    You might find Server.Transfer is a little neater as, this way, you’ll retain your POST values across the transfer. This will potentially save you a lot of cumbersome code playing around with session state, which, depending on how complex your forms are, could open the way to all kinds of unusual behaviour that you’d have to predict and plan to deal with in advance such as what happens when a user clicks the “back” button or – if you’re posting across multiple pages – what happens when a session expires (plus Servy’s examples of having multiple tabs open on the same page(s), all sharing the same session). Working with session state can be messy.

    Perform your validation on PostBack then, if Page.IsValid, do:

    Server.Transfer("/FormPage2.aspx");
    

    Server.Transfer preserves Request.QueryString and Request.Form, so you can pick up your POST values on FormPage2 and do whatever you need with them here – whether it be using them for conditional logic or rendering them out again as hidden fields to join them up with the values from the second page of the form (bear in mind that if you’re doing this you’ll have to revalidate the hidden inputs at this stage).

    http://msdn.microsoft.com/en-us/library/y4k58xk7.aspx

    I have used session state for handling complex forms in the past and found myself wishing I’d used Server.Transfer, which I plan to use for all similar endeavours in the future, unless I have a very good reason not to.

    You might also consider using a multiview, but in my experience these can be very messy.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.Net Page, aspx with its default form. I have a Submit
I have an ASP.NET form (C#) but which I click this button that should
I have an asp.net form that contains some html, 2 controls a calendar from
I have a asp.net web form which will submit information to come as emails.
I have a ASP.NET form that has a search box, with a Go button.
I have got an asp.net form, with a jqgrid on it. The user can
I have an ASP.NET page that contains a form and a button. In order
I have a multi-step data entry form in my ASP.NET MVC application. When the
I have an ASP.NET form with a cancel button that is supposed to, after
I have a form built in ASP.NET. The first control allows the user to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.