0
まで認証されていない私は、この次のMVCアプリケーションを持っているユーザーが次のページ要求
Imはプロファイル値を割り当てるしようとすると問題がある:
FormsService.SignIn(model.Email、インサイド // Attempt to register the user
MembershipCreateStatus createStatus = MembershipService.CreateUser(model.Email, model.Password);
if (createStatus == MembershipCreateStatus.Success)
{
//Adding role
MembershipService.AddDefaultRole(model.Email);
FormsService.SignIn(model.Email, false /* createPersistentCookie */);
//Add other initial profile data
HttpContext.Profile["FirstName"] = model.FirstName; //PROBLEM
HttpContext.Profile["LastName"] = model.LastName; //PROBLEM
return RedirectToAction("List", new { area = "", controller = "Requests" });
}
else
{
ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));
}
)偽:
public void SignIn(string email, bool createPersistentCookie)
{
if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email");
FormsAuthentication.SetAuthCookie(email, createPersistentCookie);
}
どうFormsAuthentication.SetAuthCookieを呼び出した後に来る、ユーザーがまだ認証されていませんか? エラーが発生しています。私は匿名ユーザーにいくつかのプロファイル値を割り当てようとしています。
これは意味があります。あなたは、次のリクエストの前にプロファイル値を更新する簡単な方法を知っていますか?値を一時的に保存して、次のページリクエストで保存する必要がありますか?それを行う正しい方法は何ですか? – Dhana
する必要がありますか?あなたの初期化イベントで、ユーザーが認証されていてもプロファイル情報がない場合は、それをロードする時間だと思うでしょうが、私は内蔵プロファイルマネージャーを一度も使用していません。 –