のメンバーシップのAPIを使用して、私は私の資格情報でログインすることができません、ここでログインフォームIは、メンバーシップAPIを使用してフォームをログインするために作成したい、私はASP.NETに新しいです</p> <p>をASP.NET
、私は、メンバーシップAPI
を使用して登録フォームを作成しLoginForm.aspx.cs
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 ");
}
}
のための私のコードスニペットです私はSuccessfulley created
として出力を得るRegistrationFormで新規ユーザーを登録する際ここ
は、RegistrationForm.aspx.cs
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);
}
}
のための私のコードスニペットですが、登録後、私はSorry Login Failed
@dhavel:あなたの質問のほとんど重要でない部分は、レジスタのユーザーで、私は成功したログインをしたい太字:) –