0

I am trying to make a simple log in page in ASP.net and this is my code:

protected void Submit1_Click(object sender, EventArgs e) 
{ 
  // Validate the user against the Membership framework user store 
  if (Membership.ValidateUser(UserName.Text, Password.Text)) 
  { 
    // Log the user into the site 
    FormsAuthentication.RedirectFromLoginPage(UserName.Text, Persist.Checked); 
    Response.Redirect("test-records.aspx"); 
  } 

  // If we reach here, the user's credentials were invalid 
  Msg.Visible = true; 
}

I don't know whats wrong because it shows no error and it just refreshes with no error even the label msg is not visible.

4

1 回答 1

0

如果您使用 MembershipProvider,并且由于您的代码似乎没有做任何特别的事情,为什么不使用登录控件,并给它成员提供程序类,就是这样!

于 2013-09-14T09:22:27.053 回答