当我像这样设置 AuthCookie
FormsAuthentication.SetAuthCookie(model.UserName, true);
model.userName 实际上是用户的电子邮件,它唯一地标识了每个用户,然后在我使用时在我看来:
Welcome <strong> @User.Identity.Name</strong>!
它显示“欢迎使用 user@mail.com!,但是我想使用 user.firstname。
所以,我的问题是,是否可以实现自定义 User.Identity 或自定义 Forms.SetAuthCookie ,这将允许我在我的视图中使用这样的东西:
Welcome <strong> @User.Identity.FirstName</strong>!