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

  • Home
  • SEARCH
  • 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 8664593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:16:40+00:00 2026-06-12T17:16:40+00:00

I am trying to send form data from one page to another using C#

  • 0

I am trying to send form data from one page to another using C# ASP.Net. I have two pages default.aspx and default2.aspx.Here is the code I have in default.aspx:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Go" 
    PostBackUrl="~/Default2.aspx" />
<br />

From what I know so far the PostBackUrl is used to set the page in which you want the data to be sent is this correct?

Also how can I retrieve the data that is sent to Default2.aspx?

  • 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-12T17:16:42+00:00Added an answer on June 12, 2026 at 5:16 pm

    You have a few options, consider

    1. Session state
    2. Query string

    Session state

    If you are going to send data between pages, you could consider the use of Session State.

    ASP.NET session state enables you to store and retrieve values for a
    user as the user navigates ASP.NET pages in a Web application. HTTP is
    a stateless protocol. This means that a Web server treats each HTTP
    request for a page as an independent request. The server retains no
    knowledge of variable values that were used during previous requests.
    ASP.NET session state identifies requests from the same browser during
    a limited time window as a session, and provides a way to persist
    variable values for the duration of that session. By default, ASP.NET
    session state is enabled for all ASP.NET applications.

    Best of all, it is easy!

    Put data in (for example on default1.aspx)

    Session["FirstName"] = FirstNameTextBox.Text;
    Session["LastName"] = LastNameTextBox.Text;
    

    Get it out (for example on default2.aspx)

    string firstname = Session["FirstName"] // value of FirstNameTextBox.Text;
    string lastname = Session["LastName"] // value of LastNameTextBox.Text; 
    

    Query string

    If you are sending small amounts of data (eg id=4), it may be more practical to use query string variables.

    You should explore the use of the query string variables, e.g.

    http://www.domain.com?param1=data1&param2=data2
    

    You can then get the data out like

    string param1 = Request.QueryString["param1"]; // value will be data1
    string param2 = Request.QueryString["param2"]; // value will be data2
    

    You can use something like How do you test your Request.QueryString[] variables? to get the data out.

    If you are unfamiliar with querystring variables check out their wikipedia article

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

Sidebar

Related Questions

We are using C#, ASP.NET & WCF. I am trying to send form data
I'm trying to send a lot of data from a form using the $.post
I am trying to send data as a model from an html form to
I`m trying to send simple html page with form data to user with GET,
I'm trying to send post data between pages with Post. Not a form -
i am trying to send email from php i have one php file with
I am trying to send data(a username and password) to an online form from
I am using asp.net mvc and I am trying to send 2 sets of
I am trying to send data from a form to a database. Here is
I'm trying to send form fields and file to a web service using php

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.