我新在ASP.NET中,登錄表單使用成員身份API在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 ");
}
}
我使用成員身份API
創建登記表的代碼片段這裏,是我的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);
}
}
代碼片段時,我登記RegistrationForm我得到輸出Successfulley created
新用戶,但註冊後,當我做與Registerd用戶名和密碼登錄我得到輸出Sorry Login Failed
@dhavel:你的問題中最不重要的部分是黑體:) – 2012-04-08 07:43:59