title: login form using Membership API in ASP.NET
body: <p>I am new In ASP.NET, </p>
  
  <p>I want to create to Login Form using Membership API, i am unable to login with my credential,</p>
  
  <p>here, is my code snippet for</p>
  
  <p><code>LoginForm.aspx.cs</code></p>
  
  <pre><code>protected void Submit_Click(object sender, EventArgs e)
  {
      if (FormsAuthentication.Authenticate(Username.Text, Password.Text))
      {
          Response.Write("Welcome " + Username.Text);
      }
      else
      {
          Response.Write("Sorry Login Failed ");
      }
  }
  </code></pre>
  
  <p>i created Registration Form using Membership API</p>
  
  <p>here, is my code snippet for  <code>RegistrationForm.aspx.cs</code></p>
  
  <pre><code> protected void AddUser_Click(object sender, EventArgs e)
  {
      MembershipCreateStatus result;
      try
      {
          MembershipUser newUser = Membership.CreateUser(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text, TextBox5.Text, true, out result);
          if (result == MembershipCreateStatus.Success)
          {
              Response.Write("Successfulley created");
          }
          else
          {
              Response.Write("Fail to Register");
          }
      }
      catch (Exception err)
      {
          Response.Write(err.Message);
      }
  }
  </code></pre>
  
  <p>when i register new user in RegistrationForm i get output as <code>Successfulley created</code>, but after Registration when i do Login with Registerd username and password i get output as <code>Sorry Login Failed</code></p>