示例#1
0
 protected void SetPassword_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         // Create the local login info and link the local account to the user
         ILoginManager  manager = new IdentityManager(new IdentityStore(new ApplicationDbContext())).Logins;
         IdentityResult result  = manager.AddLocalLogin(User.Identity.GetUserId(), User.Identity.GetUserName(), password.Text);
         if (result.Success)
         {
             Response.Redirect("~/Account/Manage?m=SetPwdSuccess");
         }
         else
         {
             AddErrors(result);
         }
     }
 }
示例#2
0
 protected void SetPassword_Click(object sender, EventArgs e)
 {
     if (IsValid)
     {
         // Create the local login info and link the local account to the user
         ILoginManager manager = new IdentityManager(new IdentityStore()).Logins;
         IdentityResult result = manager.AddLocalLogin(User.Identity.GetUserId(), User.Identity.GetUserName(), password.Text);
         if (result.Success)
         {
             Response.Redirect("~/Account/Manage?m=SetPwdSuccess");
         }
         else
         {
             AddErrors(result);
         }
     }
 }