0
プロジェクトのVisual Studio 2017アカウントフォルダにある登録コードの手順に従って、ASP.NET Identity(C#)でアカウントの確認とパスワードの回復から使用される手順。Register.aspx.csでの登録時に確認メールを送信しない
エラーメッセージ:
のSystem.InvalidOperationException 'ユーザーIDが見つかりません'
ポイントはでそれに失敗しました: をRegister.aspx.cs
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Owin;
using Owin;
using FHSF_5_DEV.Models;
:
:
:
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = UserName.Text, Email = UserEmail.Text };
IdentityResult result = manager.Create(user, Password.Text);
if (result.Succeeded)
{
string code = manager.GenerateEmailConfirmationToken(user.Id);
string callbackUrl = IdentityHelper.GetUserConfirmationRedirectUrl(code, user.Email, Request);
==> manager.SendEmail(user.Email, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>.");**