title: Retrieving page data using Query string
body: <p>I am trying to retrieve text box values from my main asp page. I ask the user to enter his name and surname into their respective text boxes. Then I click on a submit button and the button takes me to another web page called DefaultPage.aspx... The button does take me to the new page, but the text boxes values are not sent or displayed on the new page.</p>
  
  <p>Here is my Code:</p>
  
  <p>ASP Code for the button:</p>
  
  <pre><code>asp:Button ID="Submit" runat="server" Text="Button" OnClick="Submit_Click"
  </code></pre>
  
  <p>Here is my Main Page's code:</p>
  
  <pre><code>protected void Submit_Click(object sender, EventArgs e)
  {
      Response.Redirect("DefaultDetails.aspx?FirstName=" + txtFirstName.Text +    "&amp;LastName=" + txtLastName.Text);
  }
  </code></pre>
  
  <p>And here is my Default/new pages code:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (PreviousPage != null)
      {
          string firstName = Request.QueryString["FirstName"];
          string lastName = Request.QueryString["LastName"];
  
      }
  }
  </code></pre>
  
  <p>Here is my code for the 2 text boxes:</p>
  
  <pre><code>        &lt;asp:TextBox ID="txtFirstName" runat="server"&gt;&lt;/asp:TextBox&gt;
          &lt;asp:TextBox ID="txtLastName" runat="server"&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>When i insert a break at the first string line (ie firstName on the new page) the values inside of firstName and LastName are equal to null.</p>