title: how to retrive the username of the current user after login in asp.net
body: <p>I need to get the user current name after a log in. I need to display the name in the page, like <strong>welcome user</strong> . Please help me, my current code is given below</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
      {
          SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con1"].ConnectionString);
          con.Open();
          SqlCommand cmdr = new SqlCommand("Select name,password From registration", con);
          SqlDataReader dr = cmdr.ExecuteReader();
          while (dr.Read())
          {
              if (txt_name.Text == dr[0].ToString() &amp;&amp; txt_pass.Text == dr[1].ToString())
              {
                  Response.Redirect("logout.aspx");
              }
              else
              {
                  label4.Text ="Invalid Username/Password";
              }
          }
  
      }
  </code></pre>