(1)修改web.config文件
(2)关键代码:
MembershipCreateStatus status;
MembershipUser user = Membership.CreateUser("administrator", "administrator", null, null, null, true, out status);
if (user != null)
{
Roles.AddUserToRole("administrator", "supermaster");
//FormsAuthentication.RedirectFromLoginPage(user.UserName, false);
Response.Write("");
}
else
{
if (status == MembershipCreateStatus.DuplicateUserName)
Label3.Text = String.Format("用户名 \"{0}\" 已被注册", "admin");
else
Label3.Text = "注册失败~!";
}
这样就是想了用户全乡管理
阅读(848) | 评论(0) | 转发(0) |